[13100] in Perl-Users-Digest
Perl-Users Digest, Issue: 510 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 19:07:13 1999
Date: Fri, 13 Aug 1999 16:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 13 Aug 1999 Volume: 9 Number: 510
Today's topics:
Re: "set -x" equivalent in perl? (Mark Frost)
Re: C<print <FILE>;> -- is it optimized (Neko)
Re: can i read a file backwards? <stacy@beast.amd.com>
Re: Capturing input from the keyboard <liber8r@mcs.net>
child process don't end before getting output? <anonymous@web.remarq.com>
Database Connection Pooling with Perl <dortman@my-deja.com>
Re: database conversion <makkulka@cisco.REMOVETHIS.com>
Re: Fastest form of an 'if' <andrewf@beausys.freeserve.co.uk>
getting web page content <jlassen@NOSPAM.freakpress.com>
Good Web Sites on Perl/DBI/MySQL? <clavikal@voicenet.com>
Re: Looking for gibberish generator (Greg Bacon)
Re: Looking for gibberish generator (Transaction Master)
Re: Looking for gibberish generator (Kim Eggleston)
Re: Looking for gibberish generator <null@127.0.0.1>
Re: Looking for gibberish generator <revjack@radix.net>
perl script for changing all upper case letters to lowe <wedeking@msa.attmil.ne.jp>
Re: perl script for changing all upper case letters to <tchrist@mox.perl.com>
Re: Printing perldoc <elaine@chaos.wustl.edu>
Re: s/// and interpolation <cassell@mail.cor.epa.gov>
Re: saving a hash <stacy@beast.amd.com>
Spawning OS Command from Perl <dronamk@metamor.com>
SSL script question <gwhalin@numerix.com>
Re: Starnge DBI behavior (Eric Bohlman)
Re: strange syntax error on dangling curly brace "}" <cassell@mail.cor.epa.gov>
Re: Strange trouble with a STRAY CURLY BRACE "}" <mcking@cajunbro.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Aug 1999 17:08:10 -0400
From: mfrost@westnet.com (Mark Frost)
Subject: Re: "set -x" equivalent in perl?
Message-Id: <7p21fq$jrd@westnet.com>
In article <37b483b9@cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc,
> mfrost@westnet.com (Mark Frost) writes:
>:What I would *love* to have is something that equivalent to the shell's
>:"set -x" or "sh -x script.sh" where each line that is executed is
>:printed out.
>
>Hidden down in the perldebug manpage:
>
> Here's an example of using the `$ENV{PERLDB_OPTS}' variable:
[ snip, snip ]
Thanks very much. That's what I'm looking for. I was reading the
perldebug man page last night, but I think my head was already spinning
by the time I got down this far... :-)
Thanks again.
-mark frost
------------------------------
Date: 13 Aug 1999 22:32:48 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: C<print <FILE>;> -- is it optimized
Message-Id: <7p26eg$evt$0@216.39.141.200>
On Fri, 13 Aug 1999 10:46:16 -0400, Jeff Pinyan <jeffp@crusoe.net> wrote:
>I ran a test to see how to best read a big file, and print it.
I used a similar benchmark. I added 'whole' to really slurp a file. I also
use code refs instead of strings, and I seek output as well as input back to
the start.
#!/usr/bin/perl -w
use Benchmark;
open OUT, ">null";
open F, "words10"; # /dict/words x 10
timethese 4, {
array => sub { my @a = <F>; print OUT @a; seek F, 0, 0; seek OUT, 0, 0 },
loop => sub { print OUT while <F>; seek F, 0, 0; seek OUT, 0, 0 },
slurp => sub { print OUT <F>; seek F, 0, 0; seek OUT, 0, 0 },
whole => sub { local $/; print OUT <F>; seek F, 0, 0; seek OUT, 0, 0 },
};
__END__
>The file "big" is 2032350 bytes.
>
> % wc big
> 104244 261528 2032350 big
My test file has roughly twice as many lines.
% wc words10
242590 242590 2228550 words10
>The results baffled me a little:
> Benchmark: timing 4 iterations of array, loop, slurp...
> array: 13 wallclock secs (11.99 usr + 1.32 sys = 13.31 CPU)
> loop: 15 wallclock secs (10.25 usr + 0.43 sys = 10.68 CPU)
> slurp: 10 wallclock secs ( 9.22 usr + 0.32 sys = 9.54 CPU)
>
>Oh dear. I thought the while loop would be better than slurping the file
>in the C<print <FILE>;> statement.
>
>Has the 'slurp' use been optimized in Perl? If so, that'd be a good thing
>to know.
Benchmark: timing 4 iterations of array, loop, slurp, whole...
array: 18 wallclock secs (17.47 usr + 0.00 sys = 17.47 CPU)
loop: 5 wallclock secs ( 4.94 usr + 0.00 sys = 4.94 CPU)
slurp: 16 wallclock secs (16.21 usr + 0.00 sys = 16.21 CPU)
whole: 1 wallclock secs ( 1.04 usr + 0.00 sys = 1.04 CPU)
It doesn't look like 'slurp' has been optimized in my version of Perl
(5.005_02 ActiveState). And if it were to be optimized, I would hope for
something closer to 'whole' than to 'loop'.
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: Fri, 13 Aug 1999 17:43:17 -0500
From: Stacy <stacy@beast.amd.com>
Subject: Re: can i read a file backwards?
Message-Id: <37B49F85.19AEFBDC@beast.amd.com>
Mike wrote:
> May not be the best way but it works.
>
> #############################
>
> open(FILE, "normal.txt");
> @file = <FILE>;
> close(FILE);
>
> @backwards = reverse(@file);
>
> foreach(@backwards) {
> @line = split(//, $_);
> print reverse(@line);
> }
>
> #############################
>
> JCEtek wrote:
>
> > hi
> > can i start reading at eof, and read up?
In search of simplicity ...
-----reverse.pl-----
#!/usr/bin/perl -w
$/ = undef;
print reverse split (//, <>);
---------------
... of course you could do it all from the command line
perl -e '$/=undef; print reverse split(//,<>);' some.file
------------------------------
Date: Fri, 13 Aug 1999 16:47:09 -0500
From: "liberator.net" <liber8r@mcs.net>
Subject: Re: Capturing input from the keyboard
Message-Id: <7p2416$jpq$1@Nntp1.mcs.net>
Robert:
The system doesn't wait for a response. It blows right threw it as if I
never inputted anything.
--
The Liberator
E-Mail: news@liberator.net
Web Site: http://www.liberator.net/
Robert Watkins <rwatkins@springer-ny.com> wrote in message
news:37B43DC3.75364102@springer-ny.com...
Try:
use strict;
print "Please enter a number: ";
chomp(my $user_num = <STDIN>);
Then manipulate $user_num as you wish
-- Robert Watkins
"liberator.net" wrote:
>
> Sure it sounds simple, but I'm not familiar with perl. I want to quiz
> people on adding signed integers. I know how to randomly generate numbers
> but how do I wait for a keyboard response, capture the input, and test it
> for correctness.
>
> I have Perl In a Nutshell by O'Reilly but something tells me I should have
> bought Perl for Dummies.
>
> :-)
>
> If you check comp.lang.perl.tk, I have been unsuccessfully experimenting
> with the Tk module. I'd rather stick to the basics if it's possible.
Your
> knowledge and advice will be appreciated. Thanks
>
> --
> The Liberator
>
> E-Mail: news@liberator.net
> Web Site: http://www.liberator.net/
------------------------------
Date: Fri, 13 Aug 1999 13:08:50 -0800
From: Lan Chai <anonymous@web.remarq.com>
Subject: child process don't end before getting output?
Message-Id: <934578534.14401@www.remarq.com>
Hi everyone. I'm a newbie so go easy on me :^). Here's my
problem. I'm making a program that "rup" but it's not
working (obviously, why else will I post here?). I
notice that "rup" takes a long time to quit if the
server is down, so I try to make a named pipe to open
it and time it to see if it's working longer than a time
limit and if so kill it. Here's my attempt:
$timeout = 0.25; #0.25 seconds as a time limit
$pid = open (RUP, "rup $server|");
select RUP; $| = 1;
$timestart = gettimeofday; #Time:HiRes used
while (gettimeofday - $timestart < $timeout) {
if (!kill (0, $pid)) { #rup died?
#gets the output from the pipe
#print the rup things
}
last;
}
if (gettimeofday - $timestart >= $timeout) {
print STDOUT "$server timed out\n";
kill (9, $pid);
}
The output is always "timed out", even though I know rupping
that server takes faster than 0.25 seconds. I am thinking
that the child process doesn't really end before I get its
output, is that true?
* 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: Fri, 13 Aug 1999 21:25:34 GMT
From: Dave Ortman <dortman@my-deja.com>
Subject: Database Connection Pooling with Perl
Message-Id: <7p22g3$h4i$1@nnrp1.deja.com>
Hi.
I'm working on a project which utilizes Perl to speak to an Oracle
database. There were hope of implementing some sort of connection
pooling to speed up data access. I've searched a good portion of posts
on this group, as well as various Perl sites, but haven't been able to
find any examples of connection pooling. Could anyone point me to any
such samples? I'd hate to reinvent the wheel...
Thanks,
-Dave Ortman
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 13 Aug 1999 14:38:37 -0700
From: Makarand Kulkarni <makkulka@cisco.REMOVETHIS.com>
Subject: Re: database conversion
Message-Id: <37B4905D.A34CB900@cisco.REMOVETHIS.com>
[
>Sunny wrote:
> I require some assistance from someone very familiar with Perl. I have
> a file consisting of patient records. Some of the fields are LASTNAME
> FIRSTNAME MIDDLENAME SEX.. I want to output these fields, along with
> values, tab delimited. However, if a particular field is not present,
> an extra tab should be left in its place:
]
# Read each record into a hash like this.
%rec = ( LASTNAME=>'Doe',
FIRSTNAME=>'John',
MIDDLENAME=>'Frank',
SEX=>'M'
) ;
# Print out values in the order you want.
foreach ( 'LASTNAME', 'FIRSTNAME', 'MIDDLENAME', 'SEX' )
{
print $_, "=", exists $rec{$_} ? $rec{$_} : "\t", " " ;
}
print "\n" ;
Make sure that %rec is a variable declared using my() inside the loop
where you read your records.
--
------------------------------
Date: Fri, 13 Aug 1999 22:31:16 +0100
From: Andrew Fry <andrewf@beausys.freeserve.co.uk>
Subject: Re: Fastest form of an 'if'
Message-Id: <WuraeGAk6It3EwNV@beausys.freeserve.co.uk>
In article <7p12ei$sc4$1@lublin.zrz.tu-berlin.de>, Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de> writes
>Andrew Fry <andrewf@beausys.freeserve.co.uk> wrote in comp.lang.perl.misc:
>>In article <slrn7r79p4.e7v.abigail@alexandra.delanet.com>, Abigail
>><abigail@delanet.com> writes
>>>Andrew Fry (andrewf@beausys.freeserve.co.uk) wrote on MMCLXXI September
>>>MCMXCIII in <URL:news:gIL3XCAjNes3EwAE@beausys.freeserve.co.uk>:
>>>{} Which of these 3 forms of 'if a then b' is faster ?...
>>>{} 1. if (a) { b; }
>>>{} 2. b if (a);
>>>{} 3. a && b;
>>>{} ... or isnt there enough in it to worry about ?
>>>
>>>If you are kept awake at nights worrying about such things, consider
>>>removing Perl from your system, and start using C, or perhaps assembler.
>>>
>>>Abigail
>>
>>What a bloody stupid remark. Up to your usual standard.
>>
>>I was just curious, that's all.
>
>So benchmark it. Why bother the newsgroup? It's not *that*
>interesting.
>
>Anno
My, what a sarcastic, unhelpful, miserable ... and utterly patronising
... bunch you are! (Well, a few of you...)
Do you own this newsgroup ? No, you dont! Is it for the sole purpose of
the gurus to discuss 'interesting' issues ? No, it isnt!
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: Fri, 13 Aug 1999 15:25:41 -0700
From: Jeremy Lassen <jlassen@NOSPAM.freakpress.com>
Subject: getting web page content
Message-Id: <37B49B65.F260E3C3@NOSPAM.freakpress.com>
I am currently trying to automate the proccess of getting web page
content from various sites around the web. I have stumbled across a
library called http-lib.pl
(which is at
http://www.extropia.com/scripts/source/http_lib/http-lib.pl.txt )
This library has 2 functions that I am particularly interested in...
HTTPGet and HTTPPost.
They seem to work pretty damn good for my purposes, but some web sites
seem to be blocking/spoofing these routines and return (a) nothing or
(b) a customized 'invalid paramaters' type error page. I have pared
things down to essentials -- I have set up web pages that have get and
post forms that get the data I am looking for, but whenever I use the
HTTPPOST and HTTPGet libraries, using the exact same data sets, I get
spoofed.
Does anybody know how these requests are getting spoofed, or how I can
get around it? Are they possibly just doing some sort of browser
check? Can I fool a server into thinking my script is a browser?
I am specifically trying to automate searches at both Amazon and
Barnesandnobel. I would like to be able to use thier ISBN search forms
at
http://shop.barnesandnoble.com/booksearch/search.asp?
and
http://www.amazon.com/exec/obidos/subst/search/isbn.html/
Amazon specifically seems to have set up some sort of spoofing, as I can
not use the HTTPGet program to access ANY pages (though the POST seems
to work on SOME things. Note, about 3 months ago, I was able to use
this library on amazon, and had it working rather nicely.
Are there any alternatives to these libraries that would work instead?
any help would be appreciated.
-jl
------------------------------
Date: Fri, 13 Aug 1999 17:27:57 -0400
From: "Shannon Kurtas" <clavikal@voicenet.com>
Subject: Good Web Sites on Perl/DBI/MySQL?
Message-Id: <f00t3.198$FE4.41477@news2.voicenet.com>
I am in dire need of good documentation about the use of Perl with MySQL ( &
DBI ). I have a small appendix-reference of DBI/Perl in my MySQL book...but
I'm looking for something with more of a tutorial approach.
Thanks in Advance!
---------------------------------------------------------
Shannon Kurtas
clavikal@voicenet.com
ICQ:11767795 / AOL-IM:SKurtas
---------------------------------------------------------
------------------------------
Date: 13 Aug 1999 21:16:11 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Looking for gibberish generator
Message-Id: <7p21ur$s7v$1@info2.uah.edu>
In article <MPG.121e20a9702c2a47989684@news.jump.net>,
kim_eggleston@yahoo.com (Kim Eggleston) writes:
: I am looking for a perl script which generates "fake" text for use in
: creating publishing mock-ups. I don't want just random characters but
: something that looks like actual english.
Markov chains! <URL:http://www.cs.cmu.edu/~rosie/yapc/src/>
Greg
--
Bluto: My advice to you is to start drinking heavily.
Otter: Better listen to him, Flounder. He's pre-med.
------------------------------
Date: 13 Aug 1999 14:22:03 -0700
From: transact@shell.ncal.verio.com (Transaction Master)
Subject: Re: Looking for gibberish generator
Message-Id: <7p229r$o9f$1@shell1.ncal.verio.com>
In article <MPG.121e20a9702c2a47989684@news.jump.net>,
Kim Eggleston <kim_eggleston@yahoo.com> wrote:
>I am looking for a perl script which generates "fake" text for use in
>creating publishing mock-ups. I don't want just random characters but
>something that looks like actual english.
>
>Please let me know if you have any idea where I might find something like
>this or some starter code to use.
It's not perl but (psychoanalyze-pinhead) in GNU emacs is a great source of
interesting text. Probably too interesting:
Doctor: Is it because of some problems in your childhood that
you are going through all this?
Zippy: Am I in GRADUATE SCHOOL yet?
Does it bother you that your grades could improve?
Is it clean in other dimensions?
Earlier you said you felt depressed?
Actually, what I'd like is a little toy spaceship!!
How do you reconcile your plans?
Yow! Those people look exactly like Donnie and Marie Osmond!!
Or you could look into one of the Markov chain programs that were
floated in this newsgroup recently after a review of the one published
in "The Practice of Programming" by Kernighan and Pike.
------------------------------
Date: Fri, 13 Aug 1999 17:34:54 -0500
From: kim_eggleston@yahoo.com (Kim Eggleston)
Subject: Re: Looking for gibberish generator
Message-Id: <MPG.121e5988e8214af998968e@news.jump.net>
Meow comp.lang.perl.misc, meow meow David Cassell meow meow meow Meow
meow...
> Kim Eggleston wrote:
> >
> > Hello there,
> >
> > I am looking for a perl script which generates "fake" text for use in
> > creating publishing mock-ups. I don't want just random characters but
> > something that looks like actual english.
> >
> > Please let me know if you have any idea where I might find something like
> > this or some starter code to use.
>
> Well, you can always use something like:
>
> my $mock_up = 'The quick brown fox jumps over the lazy dog. ' x 2000;
>
> That should fill up a reasonable amount of space for you with
> English sentences. For something more complicated, try picking
> a dozen sentences and using rand() to select them with
> replacement over and over until your space is filled.
Actually, it looks fake... observe:
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps
over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The
quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The brain, even while glancing at something, can fire a warning if it
looks fake. I have found this to be a distracting factor in presenting
"fake" body text. If I could have something that generates more or less
"real" speech (even though when actually reading it, it might not make a
terrible amount of sense) it would benefit me greatly.
These Markov Chains... never heard of that.. what are they?
>
> David
>
------------------------------
Date: Fri, 13 Aug 1999 17:53:18 -0500
From: "Robert Burris" <null@127.0.0.1>
Subject: Re: Looking for gibberish generator
Message-Id: <7p27m7$tr8$1@ins20.netins.net>
A good Usenet feed is the best gibberish generator on the
planet!
Kim Eggleston wrote in message ...
>Hello there,
>
>I am looking for a perl script which generates "fake" text
for use in
>creating publishing mock-ups. I don't want just random
characters but
>something that looks like actual english.
>
>Please let me know if you have any idea where I might find
something like
>this or some starter code to use.
>
>Thanks,
>-Kim
------------------------------
Date: 13 Aug 1999 22:58:30 GMT
From: revjack <revjack@radix.net>
Subject: Re: Looking for gibberish generator
Message-Id: <7p27um$j5$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Kim Eggleston explains it all:
:I am looking for a perl script which generates "fake" text for use in
:creating publishing mock-ups. I don't want just random characters but
:something that looks like actual english.
Do a web search for the phrase "Lorem ipsum" - you'll find that the
publishing industry's needs have preceded yours. I believe that the chunk
of pseudo-words to which I'm referring was created specifically for the
thing you want. That is, the pseudo-words were not created based on letter
frequency, or phonemes or whatnot, but rather, on word length, kerning,
punctuation frequency, tall letters versus short letters, and other ratios
involving the visual appearance (not the content or meaning). Random
English, can, possibly, give; you, Output. Like. This.
Below is some "Lorem ipsum" text that I use to fill web pages until the
actual content is available. That's all I have (or need); there may be
more out there on the web.
This thread should be redirected, but I don't know where.
---------------------------------------------------------------
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy
nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper
suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse
molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero
eros et accumsan et iusto odio dignissim qui blandit praesent luptatum
zzril delenit augue duis dolore te feugait nulla facilisi.
------------------------------
Date: Sat, 14 Aug 1999 07:18:55 +0900
From: "Dan and/or Shelly" <wedeking@msa.attmil.ne.jp>
Subject: perl script for changing all upper case letters to lower case with first word of sentence capitolized
Message-Id: <7p25kl$n36$1@news.misawa.attmil.ne.jp>
Does anyone have a perl script that will convert text that is in all
uppercase to lowercase but still leave the first word of a sentence in upper
case?
Dan
------------------------------
Date: 13 Aug 1999 16:40:51 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl script for changing all upper case letters to lower case with first word of sentence capitolized
Message-Id: <37b49ef3@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Dan and/or Shelly" <wedeking@msa.attmil.ne.jp> writes:
:Does anyone have a perl script that will convert text that is in all
:uppercase to lowercase but still leave the first word of a sentence in upper
:case?
Once you define "sentence", this is easy. Until you do so, it is
impossible. And I don't think you're going to be able to do so
without destroying a lot of valid sentences. :-)
--tom
--
There's no such thing as a simple cache bug. --Rob Pike
------------------------------
Date: Fri, 13 Aug 1999 19:05:09 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Printing perldoc
Message-Id: <37B4A4A0.62AB70A5@chaos.wustl.edu>
"Irwin M. Feuerstein" wrote:
> How does one print using perldoc?
perldoc pipes it output to your system pager so, assuming you are using
less you may do '! <print cmd here>' and print directly from it. You can
also do perldoc perldoc > foo.txt either dump foo.txt to lpr or save a
few trees with enscript.
e.
------------------------------
Date: Fri, 13 Aug 1999 15:32:38 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: s/// and interpolation
Message-Id: <37B49D06.31FC9568@mail.cor.epa.gov>
Ala Qumsieh wrote:
>
> QuestionExchange <USENET@questionexchange.com> writes:
>
> > Perl do not work the way you try (why ? who now :)
>
> Maybe it does. But you don't know it.
>
> > You need place all replace command on one string and than
> > execute replacement by "eval" command
> > For example
> > $search = '(\d{3})-(\d{2})-(\d{4})' ;
> > $replace = 'ID#$1$2$3' ;
> > $repStr = "s/".$search."/".$replace."/" ;
> > eval ($repStr);
>
> When was the last time you checked out perlre? I advise you to go
> ahead and read it once more.
Did you go over to questionexchange.com and look up what kind
of score this guy got for this answer? :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 13 Aug 1999 16:09:35 -0500
From: Stacy <stacy@beast.amd.com>
Subject: Re: saving a hash
Message-Id: <37B4898F.F9C10AAC@beast.amd.com>
Marshall Dudley wrote:
> Does anyone know how I can read and write a hash from the hard drive so
> I don't encounter the overhead of having to recreate the hash on each
> invocation?
# One possiable method - See CPAN
use Storable;
HTH
Stacy
------------------------------
Date: Fri, 13 Aug 1999 17:04:27 -0500
From: "kiran dronamraju" <dronamk@metamor.com>
Subject: Spawning OS Command from Perl
Message-Id: <01bee5d7$ced138e0$d2eae7cd@dronamk>
Env.
Active Perl V5.18
Windows NT Server 4.0 SP 4
Trying to execute the following code with failure. Please help
@args=('notepad',' c:\perl\a.txt');
system(@args);
Doesnt work. It works fine on an NTWorkstation and Windows95.
thank you.
------------------------------
Date: Fri, 13 Aug 1999 17:08:42 -0400
From: "Gregory P. Whalin" <gwhalin@numerix.com>
Subject: SSL script question
Message-Id: <7p21e9$t73$1@ffx2nh4.news.uu.net>
Has anyone written a Perl script that will allow someone to post to a SSL
news server in an automated fashion?
Thanks!
Greg
--
Gregory Whalin
gwhalin@numerix.com
------------------------------
Date: 13 Aug 1999 23:02:51 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Starnge DBI behavior
Message-Id: <7p286r$h2l@dfw-ixnews3.ix.netcom.com>
Richard H (rhrh@hotmail.com) wrote:
: Eric Bohlman wrote:
: >
: > Unless the documentation for a function that returns a reference states
: > that it will return a unique reference on each call, you really can't
: > assume that you can just squirrel away its return value. You should make
: > your own copy of what it references and store a reference to *that*.
:
: sort of like?? :
:
: while($aref = $sth->fetchrow_arrayref) {
: my @ary1 = @$aref;
: push (@array1, \@ary1);
: }
:
: but is there a more efficient way of doing the above??
Depends on what you mean by "efficient." There's certainly a less
*verbose* way of doing it:
while(...) {
push @array1,[@$aref];
}
or even
push @array1,[@$aref] while (...);
But all these form still require perl to do pretty much the same amount
of work.
Note that in the example you gave, it is *vital* that the "my"
declaration for @ary1 stay *inside* the loop. If you moved it outside
the loop, its address would be reused each time around the loop, and
you'd wind up with an array full of references to the same location.
------------------------------
Date: Fri, 13 Aug 1999 14:12:30 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: strange syntax error on dangling curly brace "}"
Message-Id: <37B48A3E.BEEB5DBE@mail.cor.epa.gov>
jsilve1@my-deja.com wrote:
>
> This might be a repost -- I tried once but was not certain it went
> through...
Yes, this is a re-post. And you've posted this before then
as well. If Perl is complaining about this, then there must
be *some* reason. Perl is DWIM, but it isn't going to just
make stuff up. Are you sure there isn't an extra/missing
'{' or '}' hiding somewhere non-obvious, where vi would fail
on the parsing aspect of the problem?
In other words, if you have a '}' tucked in a comment,
vi would think this matched an unmatched '{' when the Perl
parser would see that it did not. That is but one reason
why the results of a vi check may not be as useful as you
thought.
If you're using vi, do you have syntax-coloring for Perl
in it? vim does that, as do other variants of vi.
That might be enough to show you how your braces/brackets/
curlies all match up. Otherwise, someone here will just
get grumpy and tell you the problem is on line 17 [an
old unix semi-joke].
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 13 Aug 1999 22:07:31 +0000
From: Mark McCoy <mcking@cajunbro.com>
Subject: Re: Strange trouble with a STRAY CURLY BRACE "}"
Message-Id: <37B49723.EFAEF7CD@cajunbro.com>
Lisa Friedland wrote:
>
> > See, the thing is that there is no matching open curly brace for this
> > close curly brace!!
>
> agreed, probably not perl's fault. When this happens to me, it means I
> have a comment line containing a curly brace--vi matches this to
> another, but perl can't see it.
>
> hope this helps,
> -Lisa
This happens to me, too, especially with syntax highlighting and regular
expressions (most often when i don't use the "/" for the regexp separator).
Remember, vim has syntax highlighting and paren/bracket completion, but it is
_not_ a full-fledged language parser (which is fine for most things).
I wonder if anyone is working on adding a full language parsing module (in perl,
of course) to vim....maybe if I didn't have 40 things to finish this week....
--
Mark McCoy -- Cajun Brothers Technology, llc
Proud to run Linux since February 1996
This message posted from snowdog, a 100% MS-free machine.
The views in this message do not necessarily reflect the views of my employer
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu.
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 510
*************************************