[13572] in Perl-Users-Digest
Perl-Users Digest, Issue: 982 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 4 16:07:19 1999
Date: Mon, 4 Oct 1999 13:05:30 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939067530-v9-i982@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 4 Oct 1999 Volume: 9 Number: 982
Today's topics:
Re: A different turn ( WAS Re: Bye Tom? ) (Craig Berry)
Re: A different turn ( WAS Re: Bye Tom? ) <dan@tuatha.sidhe.org>
Re: ActivePerl <mck@iag.net>
Re: adding (summing) elements of an array (or hash) (Craig Berry)
Bug with localtime() in Perl 5.004 and 5.005 <rrothenberg@fsnt.gis.sunysb.edu>
Re: Bug with localtime() in Perl 5.004 and 5.005 (Benjamin Franz)
Re: Bug with localtime() in Perl 5.004 and 5.005 (Alan Curry)
Building perl from source (Bill Moseley)
Re: Can I have a subroutine return a hash? (Ruben Safir)
Re: DBD and DBI install question <gellyfish@gellyfish.com>
Re: DBI/CGI Problem (cmd line works, but webserver fail <hartleh1@westat.com>
Re: DBI/CGI Problem (cmd line works, but webserver fail pyammine@my-deja.com
Re: Embedding perl with Dynaloader <bob_copeland@muntz.intercept.com>
Frames and Perl <t.mallee@atnet.de>
Re: Hashes w/multiple values per key (Perl Cookbook) kandeb@my-deja.com
Help! I'm having big trouble searching my database sleepernyc@my-deja.com
Re: Help! I'm having big trouble searching my database <makkulka@cisco.com>
Re: how can i time out a process? (Charles DeRykus)
Re: Input/output from programs <paul.walkerNOpaSPAM@st.com.invalid>
Re: Insert blank line between two lines? (Craig Berry)
Re: Loading code at run-time <stupiduid@my-deja.com>
Re: Match and escape processing (M.J.T. Guy)
Re: Match and escape processing <ltl@rgsun5.viasystems.com>
Newbie: Chomp and Case Conversion on Input (Michael W. Fleming)
Re: Newbie: Chomp and Case Conversion on Input (Larry Rosler)
Newbie: Combining split and shift on One Statement (Michael W. Fleming)
Re: Newbie: Combining split and shift on One Statement (Andrew Johnson)
Re: Newbie: Combining split and shift on One Statement <sariq@texas.net>
On WNT4, need to retrieve remote info <gilles.bellaches@somepost.fr>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 04 Oct 1999 19:54:51 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: A different turn ( WAS Re: Bye Tom? )
Message-Id: <rvi1gbi8rad81@corp.supernews.com>
Elaine -HFB- Ashton (elaine@chaos.wustl.edu) wrote:
: Craig Berry wrote:
: > : Which is not to say, however, that the medium is completely impersonal,
: > : but vapid tirades between strangers via email/usenet is pretty silly. It
: > : ultimately means nothing.
: >
: > It means no more nor less than the emotional/irrational components of life
: > in general. Saying that medium of interaction X causes the messages it
: > carries to 'mean' more or less than those carried on medium Y strikes me
: > as an odd argument, McLuhan (sp?) to the contrary of course.
:
: The next time you get a perfumed love letter from a complete stranger on
: the internet, you call me :)
The next time you get a perfumed love letter from a complete stranger in
*any* medium, you call me. Love letters are exchanged between lovers.
I've recieved them via both electrons and dead trees, and they've both
been love letters with or without olfactory enhancement. :)
: Indulge me here as I know this is off topic, yet of interest to the
: problem at hand and something I've thought about for some time.
Which makes (at least) two of us. I find this topic touches on some of
the most interesting and fundamental changes going on in our society.
: I do lots of things on the net, e.g. buy books, buy groceries, buy
: airline tickets, arrange accomodation, read news, surf aimlessly,
: conduct business via email, etc. At no point do I find any of these
: actions 'personal communication'. Sometimes, if I know the person whom
: I'm exchanging email with, it will be more personal than other email.
: People can expound upon very personal issues, problems, situations via
: email, but even then, it is a pale substitute for personal interaction.
: I can't make love to my powerbook, sexy though it may be, nor can I
: reach out and touch someone with sendmail. I sit out on my deck at home
: and never get a hello from a neighbor yet they probably get on the net
: and feel more attatched to some complete stranger 5,000 miles away.
And notice that this has everything in common with every other form of
interaction. I go to the supermarket and am three feet away from the
checker, but we don't interact beyond meaningless pleasantries; it's a
business situation, not a social one, and each of us sees the other as a
role rather than a person. I go online and trade emails or chat realtime
with a friend who's now living on the opposite coast, and the sense of
closeness and warmth is strong. It's about relationships, not media.
There are indeed types of communication and levels of relationship which
can only be done in person, but that doesn't make all the others which
transmit over the net just fine any less real or valid -- or pleasing.
: My point here is that people seem to be more comfortable communicating
: in the anonymous world of the internet rather than in the analog world
: where communication is far more personal.
It's not that black and white. Real world communication offers more
opportunities for 'personal-level' communication, but, as in your example
with your neighbor, only a tiny number of the potential interactions ever
reach that level. And conversely, online communication offers a narrower
spectrum of potential modes of communication, and may indeed subtly favor
or reinforce impersonality, but it can and does also carry fully-textured
human relationship-level communication.
Yes, on the whole, I'd rather be at home or out partying with all my
friends and loved ones. But I'll definitely take 'seeing' them on the net
as an excellent practical alternative, given that they're scattered over
most of the planet.
: Someone whom I have never met
: who insults me will get nowhere as I don't know them and they don't know
: me so how on earth could it possibly be 'personal'?
Those of us who participate actively in any net community come to know one
another (or at least aspects of one another) quite well. I'm sure anyone
reading this newsgroup could provide vivid personality sketches of the top
ten contributors. It's not all dry data exchange; there's a real
community aspect. And in that community, one has honor and reputation to
defend, and thus insults can be both given and received in a meaningful
way.
: When was the last time any of you got out from behind the computer and
: took the day to enjoy the outdoors, invited your <insert romantic noun
: here> for dinner, talked to your neighbors, wrote an actual analog piece
: of mail, etc.? It's fall in New England and the leaves are just starting
: to reach peak colour.
Other than the analog mail, within the past two days on all points. :)
Given we have only two seasons in LA (hot and dry, warm and mostly dry) I
can't join you in appreciating the foliage, sad to say.
: Sometimes the internet seems absurd.
With *that* I will heartily agree.
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "There it is; take it." - William Mulholland
------------------------------
Date: Mon, 04 Oct 1999 19:58:55 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: A different turn ( WAS Re: Bye Tom? )
Message-Id: <3G7K3.5680$S32.11576@news.rdc1.ct.home.com>
Elaine -HFB- Ashton <elaine@chaos.wustl.edu> wrote:
I agree completely with everything you said up until this point:
> Sometimes the internet seems absurd.
When exactly does it *not* seem absurd? That's the bit that's got me puzzled.
Dan
------------------------------
Date: Mon, 04 Oct 1999 12:37:39 -0400
From: Matt <mck@iag.net>
Subject: Re: ActivePerl
Message-Id: <ndb4N8gbYVbHye9YrQnxCnA2F4ZL@4ax.com>
On Sat, 2 Oct 1999 23:59:35 -0400, <joeyandsherry@mindspring.com>
wrote:
>Hello,
>
>Thanks in advance.
>
>I've just installed ActivePerl on my Win98 laptop. I've tried to execute the
>script below:
>
>print "Content-type: test/html\n\n";
>print "<HTML><HEAD><TITLE>Test</TITLE></HEAD>\n";
>print "<BODY>\n";
>print "Hello World!\n";
>print "</BODY></HTML>\n";
>
>I expected my Web Browser to open up and display Hello World!
>Have I really missed something, What gives?
>
>Any assistance would be greatly appreciated.
>
>Joey
Are you trying to run the above on a server, or directly within a
browser?
It is possible to run Perl from within MS Internet Explorer. Either
way see
http://msdn.microsoft.com/workshop/languages/clinic/scripting012299.asp
for examples.
Your code above can run in IE 4.0+ if written as follows:
<html>
<head><title>Test</title></head>
<body>
<script language="PerlScript">$window->document->write("Hello
World!");</script>
</body>
</html>
------------------------------
Date: Mon, 04 Oct 1999 19:33:11 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: adding (summing) elements of an array (or hash)
Message-Id: <rvi07n12mom50@corp.supernews.com>
NJPin (njpin@aol.com) wrote:
: I'm reading a VERY big file and creating a number of arrays using substring to
: break up the appropriate columns into the appropriate arrays. The arrays are
: indexed off the value of the first substring (which is why I'm changing my code
: to use hashes instead of arrays...I wasn't aware of the potential memory issues
: until I re-read Advanced Perl Programming's section on memory allocation and
: arrays -- what a great book!)...but anyway, that doesn't matter here...I was
: wondering what the most efficient way to sum up all the values of my array (or
: hash) is. I am concerned with efficiency here because of the size of my infile
: and because of the number of operations I'm already doing with the other
: substrings. Any suggestions would be greatly appreciated.
Only two obvious ways I can think of doing it...
#!/usr/bin/perl -w
# sumarray - benchmarks various ways to sum an array
# Craig Berry (19991004)
use Benchmark;
my @values = ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 );
my $sum;
timethese(10000, {
'foreach' => sub { $sum = 0; foreach (@values) { $sum += $_; } },
'eval' => sub { $sum = eval join ' + ', @values; }
});
Results, not surprisingly:
Benchmark: timing 10000 iterations of eval, foreach...
eval: 66 secs (50.13 usr 0.01 sys = 50.14 cpu)
foreach: 6 secs ( 5.39 usr 0.00 sys = 5.39 cpu)
Anybody else have an idea on how to beat 'foreach'?
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "There it is; take it." - William Mulholland
------------------------------
Date: Mon, 04 Oct 1999 15:17:36 -0400
From: Robert Rothenberg <rrothenberg@fsnt.gis.sunysb.edu>
Subject: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <37F8FD50.DDBF5F32@fsnt.gis.sunysb.edu>
The localtime() function is not computing dates correctly.
Run the code below and you get the folling glitch:
9 30 99 941342400
9 31 99 941428800
9 31 99 941515200
10 1 99 941601600
10 2 99 941688000
Notice that October 31 is printed out twice (month is 0..11 in
Perl).
Or if this is not a bug but a "feature" please explain it to me.
#/usr/bin/perl
$seconds_per_day = 86400;
$month = 9; # October
$day = 30;
$year = 99; # 1999
use Time::Local;
$epoch_time = timelocal(0, 0, 0, $day, $month, $year);
do {
($sec, $min, $hour, $mday, $mon, $year) = localtime($epoch_time);
$epoch_time += $seconds_per_day;
print $mon, "\t", $mday, "\t", $year, "\t", $epoch_time, "\n";
} while ($mon<11);
------------------------------
Date: Mon, 04 Oct 1999 19:30:50 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <Kf7K3.6$PG3.1261@typhoon01.swbell.net>
In article <37F8FD50.DDBF5F32@fsnt.gis.sunysb.edu>,
Robert Rothenberg <rrothenberg@notes.cc.sunysb.edu> wrote:
>
>The localtime() function is not computing dates correctly.
>Run the code below and you get the folling glitch:
>
> 9 30 99 941342400
> 9 31 99 941428800
> 9 31 99 941515200
> 10 1 99 941601600
> 10 2 99 941688000
>
>Notice that October 31 is printed out twice (month is 0..11 in
>Perl).
>
>Or if this is not a bug but a "feature" please explain it to me.
Daylight savings time.
--
Benjamin Franz
------------------------------
Date: Mon, 04 Oct 1999 19:33:14 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <_h7K3.14074$t%3.1085991@typ11.nn.bcandid.com>
In article <37F8FD50.DDBF5F32@fsnt.gis.sunysb.edu>,
Robert Rothenberg <rrothenberg@notes.cc.sunysb.edu> wrote:
>$seconds_per_day = 86400;
Are you sure about that? What about DST and leap seconds?
In my timezone (US/East-Indiana), your program doesn't print 9/31 twice.
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Mon, 4 Oct 1999 09:58:11 -0700
From: moseley@best.com (Bill Moseley)
Subject: Building perl from source
Message-Id: <MPG.12627c818161dad19897cb@206.184.139.132>
I've got these installed on a Win 98 machine.
MSVC++ 4.0
Mingw32 w/ gcc 2.95
Cygwin w/ gcc 2.95
What's the best to build perl with? Or should I upgrade to MSVC++ 5
first and use that?
I've heard that programs build with Cygwin libraries are slow. Anyone
confirm that?
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Mon, 04 Oct 1999 19:45:04 GMT
From: ruben@llinderman.dental.nyu.edu (Ruben Safir)
Subject: Re: Can I have a subroutine return a hash?
Message-Id: <4t7K3.27$BD3.1872@typhoon.nyu.edu>
[Posted and mailed]
No
But you can return a hash reference.
Ruben I Safir
Intranet Programing Manager
NYU
In article <37CCA3A2.C5832276@ix.netcom.com>,
gremlin <gremlin_NO_SPAM_@ix.netcom.com> writes:
> Hi;
>
> I would like to call a subroutine and have that routine open up a file,
> add data to a hash, and return the new hash to the calling routine. I
> have everything working except getting the data back to the caller! Can
> anyone show me the declaration; call; sub. return statement that will
> make all this work?
>
> Thanks,
> Mike
>
------------------------------
Date: 3 Oct 1999 20:54:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBD and DBI install question
Message-Id: <7t8fqt$a1u$1@gellyfish.btinternet.com>
In comp.lang.perl.misc mr_potato_head@my-deja.com wrote:
> Hi,
> I'm installing DBI and DBD on my system and I'm running into install
> problems. I want to install these into my /usr/local directory but
> this directory is automounted to my NFS server. If I try to install
> these modules to my NFS server, it doesn't have Informix. So I decided
> to install these modules to a machine that does have Informix 7.23 UC9
> on it. I'm trying to install everything into /u/local and then I was
> going to copy all the files to the NFS server so I can use the DBI and
> DBD from other machines. I was successful in installing the DBI module
> in the /u/local directory and copying it over to my NFS server so now I
> can see it in /usr/local. But when I try to setup DBD I get errors.
> To make it simple I just left DBD in the directory /u/DBD and ran "perl
> Makefile.PL". Then I ran "make", and then "make test" and got the
> following:
>
> n30# make test
> PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib -
> I/usr/local/lib/perl5/5.00502/sun4-solaris -I/usr/local/lib/perl5/5.00
> 502 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests
> @ARGV;' t/*.t
> t/t00basic..........DBI->connect failed: SQL: -329: Database not found
> or no system permission.
> ISAM: -111: ISAM error: no record found.
> at blib/lib/DBD/InformixTest.pm line 74
> !! Terminating Test !!
>
You need to have the 'stores' database available when you do the make test.
You might need to rename 'stores7' to stores ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Mon, 04 Oct 1999 12:44:52 -0400
From: HHH <hartleh1@westat.com>
Subject: Re: DBI/CGI Problem (cmd line works, but webserver fails to connect)
Message-Id: <37F8D984.5D86A6A1@westat.com>
I can think of two possibilities and there are almost certainly more.
1. Try changing the file permissions so that everyone has full control
over the mdb file. If that fixes things, you know it is a permissions
problem and can work from there to get it set the way you want.
2. If MS Access is running and the file is open, this response is pretty
likely. Make sure the file is not opened by anyone else when the Perl
script tries to access it.
Hope this helps.
HHH
David Salgado wrote:
>
> I have written a script that uses DBI and CGI to fetch data from an
> Access 97 database.
>
> When run from the command-line (perl myscript.pl), the script outputs
> appropriate HTML with the data from the database.
>
> However, when called as a web page, I get;
>
> >DBI->connect failed: [Microsoft][ODBC Microsoft Access 97 Driver]
------------------------------
Date: Mon, 04 Oct 1999 18:25:24 GMT
From: pyammine@my-deja.com
Subject: Re: DBI/CGI Problem (cmd line works, but webserver fails to connect)
Message-Id: <7tare3$dcp$1@nnrp1.deja.com>
>
> David Salgado wrote:
> >
> > I have written a script that uses DBI and CGI to fetch data from an
> > Access 97 database.
> >
> > When run from the command-line (perl myscript.pl), the script
outputs
> > appropriate HTML with the data from the database.
> >
> > However, when called as a web page, I get;
> >
> > >DBI->connect failed: [Microsoft][ODBC Microsoft Access 97 Driver]
Are you running IIS 4.0? Can you provide the code that you use to
connect to the DB?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 04 Oct 1999 17:35:44 GMT
From: Bob Copeland <bob_copeland@muntz.intercept.com>
Subject: Re: Embedding perl with Dynaloader
Message-Id: <Qz5K3.1734$GH4.3321@client>
Bob Copeland <bob_copeland@muntz.intercept.com> wrote:
> gcc -o executable f1.a f2.a f3.a f4.a -Lpath_to_perl -lperl
> /path_to_perl/lib/auto/DynaLoader/DynaLoader.a
Ok, I figured this out. GNU and the HP ld doesn't, by default,
export symbols, whereas the Sun does. I needed the -Wl,-E
in there.
--
Bob Copeland %% bob_copeland@intercept.com
Software Engineer %% http://www.intercept.com
Intercept Technology Inc. %% 404-352-0111 fax: 404-352-3744
------------------------------
Date: 4 Oct 1999 16:28:17 GMT
From: "Thomas Mallee" <t.mallee@atnet.de>
Subject: Frames and Perl
Message-Id: <7takj1$4c3$1@surz18.HRZ.Uni-Marburg.DE>
Hi,
how to send the (HTML-) output to a frame using perl? I tried the -target
attribut of cgi.pm. Worked fine with Netscape but failed with IE.
Any suggestions? Thanks!
------------------------------
Date: Mon, 04 Oct 1999 17:15:46 GMT
From: kandeb@my-deja.com
To: cassell@mail.cor.epa.gov
Subject: Re: Hashes w/multiple values per key (Perl Cookbook)
Message-Id: <7tanbj$a5e$1@nnrp1.deja.com>
> Have you considered using a zero-width assertion as your pattern
> here? Instead of using /^-*C/ you could use something like /^(?=-*C)/
> so it wouldn't gobble up the first part of your line.
For some reason, this isn't working at all for me. I get "0 chunks
found." which indicates no match. It is syntactically okay (no
complaints from -w), therefore the regexpr must not be quite right.
First, here's a simple representation of the logfile being parsed:
------------------ Configuration: A -----------------
some text A1
some text A2
some text A3
some text A4
------------------ Configuration: b -----------------
some text B1
some text B2
link: error: whoknowswhat
some text B3
some text B4
some text B5
some text B6
------------------ Configuration: c -----------------
some text C1
some text C2
some text C3
Here's a sample of my code (with help from Tom Kralidis). Note
that the 2nd @chunks line is commented out. If this is left in
and the 1st one commented out, the program works - sort of. I
lose the header, but the rest is printed out fine. However,
this won't work for me - I need that header line. David suggests
the same solution I found in Cookbook, but I haven't been able
to get the pattern match right?!
What am I missing???
while (<>) {
@chunks = split(/^(?=-*.Configuration.*)/, $_);
# @chunks = split(/^(*.Configuration.*)/, $_);
shift @chunks;
$totchunks = scalar(@chunks);
print "$totchunks chunks found.\n";
foreach (@chunks) {
print if (/.*error.*/m)
}
Any help would be great.
Thanks,
deb
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 04 Oct 1999 19:06:53 GMT
From: sleepernyc@my-deja.com
Subject: Help! I'm having big trouble searching my database
Message-Id: <7tats1$fbn$1@nnrp1.deja.com>
Hello group:
I am not a Perl programmer (yet), and am putting up a site with a
search engine. Unfortunately, there's something wrong with the code
which I am sure would be SIMPLE for someone who really knows PERL, but
I don't know anyone who does.
When I select an option from one drop down menu, and one from another
dropdown menu, the search is supposed to return ONLY those records that
match both fields.
Might anyone be willing to look at this code and offer suggestions?
check out www.tasteofbrooklyn.com/tob/cgi-bin/dbman/main3.html
Many thanks!
cyborgny@bestweb.net
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 04 Oct 1999 12:28:02 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Help! I'm having big trouble searching my database
Message-Id: <37F8FFC2.704B3FA9@cisco.com>
[ sleepernyc@my-deja.com wrote:
> Might anyone be willing to look at this code and offer suggestions?
> check out www.tasteofbrooklyn.com/tob/cgi-bin/dbman/main3.html
Yes. I will try to help.
Mail me the code.
-
------------------------------
Date: Mon, 4 Oct 1999 19:02:56 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: how can i time out a process?
Message-Id: <FJ3E8x.JtA@news.boeing.com>
In article <Pine.BSF.4.10.9910011211480.35782-100000@telecom.lek.ru>,
Taras V. Plakhotnichenko <taras@telecom.lek.ru> wrote:
>
>How can i do the following:
>
>Automatic exit from current parent process if the forked child is dead.
A possibility provided you don't need any cleanup in
the parent once the child's termination signal is
received:
my $pid = fork;
...
$SIG{CHLD} = sub { waitpid($pid,0) >0 and exit };
>If the child is still alive - automatic exit from the current process and
>killing the child after a certain amount of time.
>
my $pid = fork;
die "can't fork: $!" unless defined $pid;
if ($pid) { # parent
eval { ... }; # set a timeout alarm here
... check error return: $@ # for details: perldoc perlipc
# if there was a timeout
my $killed = kill('TERM', $pid) || kill('KILL', $pid);
die "can't kill $pid\n" unless $killed;
} else # child
...
}
HTH,
--
Charles DeRykus
------------------------------
Date: Mon, 04 Oct 1999 09:46:17 -0700
From: Paul Walker <paul.walkerNOpaSPAM@st.com.invalid>
Subject: Re: Input/output from programs
Message-Id: <11f733ec.b1ec4fb6@usw-ex0101-005.remarq.com>
In article
<Pine.GSO.4.10.9910040721590.14462-100000@crusoe.crusoe.net>, Jeff
Pinyan <jeffp@crusoe.net> wrote:
> use IPC::Open2;
> open2(\*READ, \*WRITE, "program", "arg1", "arg2") or
> die "can't run program: $!";
> print WRITE "...\n";
> chomp($ans = <READ>);
[snip]
Looks promising, anyway. :-) Doesn't quite work just yet, but I'll see
if I can get our IT department to install a newer version of perl first
(we're still using 5.001, for some reason).
Thanks,
Paul
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Mon, 04 Oct 1999 19:11:06 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Insert blank line between two lines?
Message-Id: <rvhuuau2mom70@corp.supernews.com>
Jason T. Breitweg (Jason.Breitweg@blind-guardian.com) wrote:
: I am a self-professed perl beginner and I am having a tremendous brain
: fart on how to do the following:
:
: I have a bunch of lines (my CD list actually) and I want to put a new
: line between lines that have a different first character. For example
: the original file would look like:
:
: Blind Guardian - Imaginations from the Other Side
: Blind Guardian - Nightfall in Middle Earth
: Dream Theater - Falling Into Infinity
:
: and I would like it to become:
:
: Blind Guardian - Imaginations from the Other Side
: Blind Guardian - Nightfall in Middle Earth
:
: Dream Theater - Falling Into Infinity
:
: Could someone enlighten me on how to do this? Thanks in advance.
#!/usr/bin/perl -w
# blankins - Insert blank line between lines having differing
# initial characters. Leaves blank input lines alone.
# Reads parms or stdin, writes stdout.
# Craig Berry (19991004)
use strict;
my $init = '';
while (<>) {
my $next_init = substr $_, 0, 1;
print "\n" if $init &&
$next_init ne "\n" &&
$next_init ne $init;
print;
$init = $next_init;
}
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "There it is; take it." - William Mulholland
------------------------------
Date: Mon, 04 Oct 1999 18:15:04 GMT
From: Channing <stupiduid@my-deja.com>
Subject: Re: Loading code at run-time
Message-Id: <37F8EEDA.6943E025@my-deja.com>
Jonathan Stowe wrote:
>
> Robert Young <tekwiz@home.com> wrote:
> > I am interested in knowing the technique for loading new code at runtime.
> > Specifically, the port to SCO UNIX that I have does not have many of the
> > very nice modules that are included in the resource kit (not in the source
> > code either), such as the DateCalc and the DateManip modules.
> >
> > I have inferred from reading, that it should be possible from compiling and
> > linking the source provided with the resource kit, to use these moduleks at
> > runtime but haven't been able to figure it out yet. Could someone please
> > give me a hand with this?
> >
>
> Sorry I'm not quite sure what you mean - I use SCO at work and have built
> perl and installed several modules - what specific problems are you having ?
>
Jonathan,
If I may ask.
Which SCO (and version) and what Perl version ?
------------------------------
Date: 4 Oct 1999 16:17:36 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Match and escape processing
Message-Id: <7tajv0$kuq$1@pegasus.csx.cam.ac.uk>
lt lindley <lee.lindley@bigfoot.com> wrote:
>M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
>:>And while you're about it, think carefully whether you want that test
>:>anchored:
>
>:> $xyz =~ /^\Q$xyz$/;
>
>What does \Q do to the last $ in the above? I think it quotes it.
>Yep, it does. The above doesn't match for any value of $xyz
>that I can think of.
>
> $xyz =~ /^\Q$xyz\E$/;
Hmmm... interesting. So that provides a counterexample to perlre:
You cannot include a literal $ or @ within a \Q sequence. An
unescaped $ or @ interpolates the corresponding variable,
while escaping will cause the literal string \$ to be
inserted. You'll need to write something like
m/\Quser\E\@\Qhost/.
Mike Guy
------------------------------
Date: 4 Oct 1999 17:36:32 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Match and escape processing
Message-Id: <7taoj0$i1r$1@rguxd.viasystems.com>
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
[snipped discussion of /^\Q$something$/]
:>Hmmm... interesting. So that provides a counterexample to perlre:
:> You cannot include a literal $ or @ within a \Q sequence. An
:> unescaped $ or @ interpolates the corresponding variable,
:> while escaping will cause the literal string \$ to be
:> inserted. You'll need to write something like
:> m/\Quser\E\@\Qhost/.
It doesn't really contradict the documentation; there is no variable
name after the $ to interpolate. But it is bizarre enough to be hard
to predict. After all, "something$" is not a legal double quoted
string, yet \Q is applied during the string interpolation phase of
regexp evaluation (or so says the often flawed model of Perl in my
head). I had to compile the regexp with qr{} and examine it with the
debugger to be sure.
If somebody comes back and claims that it is obvious, we can gang
up on them. :-)
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Mon, 04 Oct 1999 11:41:54 -0700
From: mfleming@csub.edu (Michael W. Fleming)
Subject: Newbie: Chomp and Case Conversion on Input
Message-Id: <mfleming-0410991141540001@cserv51.csubak.edu>
If there is a way, how would I compose a single statement that
accomplishes the same function as the following two statements?
chomp($line=<STDIN>;
$line =~ tr/A-Z/a-z/;
Would the same solution work for @lines=<STDIN>?
Thanks.
Michael
--
Michael W. Fleming, Network Analyst, California State University
Voice/mail:(661)664-2118 (24hrs) Fax:(661)664-2099 (24hrs)
Disclaimer: I directly represent only myself and my family;
indirectly, I represent God and all His creation.
------------------------------
Date: Mon, 4 Oct 1999 12:07:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie: Chomp and Case Conversion on Input
Message-Id: <MPG.12629add13dcb82e98a030@nntp.hpl.hp.com>
In article <mfleming-0410991141540001@cserv51.csubak.edu> on Mon, 04 Oct
1999 11:41:54 -0700, Michael W. Fleming <mfleming@csub.edu> says...
> If there is a way, how would I compose a single statement that
> accomplishes the same function as the following two statements?
>
> chomp($line=<STDIN>;
> $line =~ tr/A-Z/a-z/;
chomp, tr/A-Z/a-z/ for $line = <STDIN>;
> Would the same solution work for @lines=<STDIN>?
chomp, tr/A-Z/a-z/ for @lines = <STDIN>;
> Thanks.
You're welcome. Now I have to wonder why anyone cares about piling
several operations into one statement. Does Cal State Bakersfield
charge exorbitant rates per semicolon?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 04 Oct 1999 11:55:46 -0700
From: mfleming@csub.edu (Michael W. Fleming)
Subject: Newbie: Combining split and shift on One Statement
Message-Id: <mfleming-0410991155460001@cserv51.csubak.edu>
I have the following situation:
$x = " abc xxx";
@stuff = split(/\s+/,$x);
shift(@stuff);
I have tried all manner of non-working attempts at combining the
functionality of the split and shift into one statement. I have tried a
few different regexes in the split (learning some of the glories of
backtracking in the process) but my skills are not up to it. I have tried
feeding the split to the shift **shift(@stuff=(split(blah));** but the
shift complains of indigestion.
How might I accomplish this?
Thanks,
Michael
--
Michael W. Fleming, Network Analyst, California State University
Voice/mail:(661)664-2118 (24hrs) Fax:(661)664-2099 (24hrs)
Disclaimer: I directly represent only myself and my family;
indirectly, I represent God and all His creation.
------------------------------
Date: Mon, 04 Oct 1999 19:40:39 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Newbie: Combining split and shift on One Statement
Message-Id: <Xo7K3.7008$Vg4.293688@news1.rdc2.on.home.com>
In article <mfleming-0410991155460001@cserv51.csubak.edu>,
Michael W. Fleming <mfleming@csub.edu> wrote:
! I have the following situation:
!
! $x = " abc xxx";
! @stuff = split(/\s+/,$x);
! shift(@stuff);
!
! I have tried all manner of non-working attempts at combining the
! functionality of the split and shift into one statement. I have tried a
well, if you are wanting to discard the first element of the list
returned by split() then you could use:
$x = ' abc xxx';
(undef, @stuff) = split /\s+/, $x;
print join '|', @stuff;
But, I suspect you are more worried by the leading null field which
you could do away with using the special case of supplying a single
space as the first argument to split(), which will ignore leading
whitespace:
$x = ' abc xxx';
@stuff = split ' ', $x;
print join '|', @stuff;
see: perldoc -f split
regards
andrew
------------------------------
Date: Mon, 04 Oct 1999 14:49:27 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Newbie: Combining split and shift on One Statement
Message-Id: <37F904C7.11972235@texas.net>
"Michael W. Fleming" wrote:
>
> I have the following situation:
>
> $x = " abc xxx";
> @stuff = split(/\s+/,$x);
> shift(@stuff);
>
> I have tried all manner of non-working attempts at combining the
> functionality of the split and shift into one statement. I have tried a
> few different regexes in the split (learning some of the glories of
> backtracking in the process) but my skills are not up to it. I have tried
> feeding the split to the shift **shift(@stuff=(split(blah));** but the
> shift complains of indigestion.
>
> How might I accomplish this?
>
> Thanks,
>
> Michael
perldoc -f split
explains this issue precisely.
After you're done reading that (or even before), read:
perldoc perl
perldoc perldoc
perldoc perltoc
There's a wealth of information that will save you the time of posting
and waiting for replies, and save us the time it takes to answer the
same question over and over again.
Do your homework before asking here.
- Tom
------------------------------
Date: Mon, 04 Oct 1999 17:29:46 +0200
From: Gilles <gilles.bellaches@somepost.fr>
Subject: On WNT4, need to retrieve remote info
Message-Id: <37F8C7EA.2453D639@somepost.fr>
Hi,
On my network, i will to get a lot of informations on the remote
computers such as type of processor, memory... but ABSOLUTELY the OEM
licence number !!!
For the global informations, i am close to do it, but for the licence
number i don't have any ideas !! However, while it is possible to get
this information with the 'Windows NT Diagnostic' administration tool, i
suppose it can be possible to do it in Perl.
So the question is HOW or what module i have to use, or where can i find
informations to do it (for instance, i found nothing.....pffff) ???
Thanks for help !!
Gilles
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 982
*************************************