[25116] in Perl-Users-Digest
Perl-Users Digest, Issue: 7366 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 5 18:05:43 2004
Date: Fri, 5 Nov 2004 15:05:09 -0800 (PST)
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, 5 Nov 2004 Volume: 10 Number: 7366
Today's topics:
$& imposes a considerable performance penalty they say <jidanni@jidanni.org>
Re: $& imposes a considerable performance penalty they <noreply@gunnar.cc>
Re: $& imposes a considerable performance penalty they <uguttman@athenahealth.com>
A small Perl problem (Ali)
Re: A small Perl problem <ioneabu@yahoo.com>
Re: A small Perl problem <notvalid@email.com>
Re: A small Perl problem <bik.mido@tiscalinet.it>
Re: A small Perl problem <gnari@simnet.is>
Re: Array -> Reference to Hash of Arrays <ioneabu@yahoo.com>
Re: Array -> Reference to Hash of Arrays <emschwar@pobox.com>
Re: Array -> Reference to Hash of Arrays <bmb@ginger.libs.uga.edu>
Re: Array -> Reference to Hash of Arrays <ioneabu@yahoo.com>
Re: Array -> Reference to Hash of Arrays <ioneabu@yahoo.com>
Re: Array -> Reference to Hash of Arrays <emschwar@pobox.com>
Re: Array -> Reference to Hash of Arrays <ioneabu@yahoo.com>
Re: Check POP3 E-mail <usenet@morrow.me.uk>
Re: Check POP3 E-mail <dsgSPAMFILTER@alum.dartmouth.org>
FAQ 5.36: How do I select a random line from a file? <comdog@panix.com>
Re: Finding consecutive lines <bmb@ginger.libs.uga.edu>
Re: Finding consecutive lines <bik.mido@tiscalinet.it>
Logging UDP Packets <nospam.hciss@yahoo.com>
Re: Net::LDAP help <glex_nospam@qwest.invalid>
Re: Q: re Inline and Benchmark <tassilo.von.parseval@rwth-aachen.de>
Re: Q: re Inline and Benchmark <nospam-abuse@ilyaz.org>
remove unwanted parts from strings <bdu@iastate.edu>
Re: remove unwanted parts from strings <barachielNOSPAM@gmx.net>
Re: remove unwanted parts from strings <eighner@io.com>
Re: Solaris taking over Perl ownership <matternc@comcast.net>
Re: Spurious "Use of uninitialized value" with -w, redu <bik.mido@tiscalinet.it>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 06 Nov 2004 05:48:34 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: $& imposes a considerable performance penalty they say
Message-Id: <871xf82ci5.fsf@jidanni.org>
$ man perlvar
$& The string matched by the last successful pattern match...
The use of this variable anywhere in a program imposes a con-
siderable performance penalty on all regular expression
matches. See "BUGS".
$ time echo x|perl -wpe 's/(x)/a$1y/'
axy
real 0m0.011s
user 0m0.003s
sys 0m0.004s
$ time echo x|perl -wpe 's/x/a$&y/'
axy
real 0m0.007s
user 0m0.001s
sys 0m0.006s
I'm not sure which of the times means money, but if it is real, then
what's the deal?
------------------------------
Date: Fri, 05 Nov 2004 23:21:51 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: $& imposes a considerable performance penalty they say
Message-Id: <2v2d0pF28oriaU1@uni-berlin.de>
Dan Jacobson wrote:
> $ man perlvar
> $& The string matched by the last successful pattern match...
> The use of this variable anywhere in a program imposes a con-
> siderable performance penalty on all regular expression
> matches. See "BUGS".
> $ time echo x|perl -wpe 's/(x)/a$1y/'
> axy
> real 0m0.011s
> user 0m0.003s
> sys 0m0.004s
> $ time echo x|perl -wpe 's/x/a$&y/'
> axy
> real 0m0.007s
> user 0m0.001s
> sys 0m0.006s
>
> I'm not sure which of the times means money, but if it is real, then
> what's the deal?
Even if I have never tried to quantify the claimed performance penalty
caused by $&, I realize that your above examples are not sufficient for
drawing any conclusions. The point, if I have understood it correctly,
is that the use of $& *once* enables capturing for *all* regular
expressions in the program, also those without capturing parentheses or
capturing through $&.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 05 Nov 2004 17:46:36 -0500
From: Uri Guttman <uguttman@athenahealth.com>
Subject: Re: $& imposes a considerable performance penalty they say
Message-Id: <m3breblxrn.fsf@lap.athenahealth.com>
>>>>> "GH" == Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
GH> Even if I have never tried to quantify the claimed performance
GH> penalty caused by $&, I realize that your above examples are not
GH> sufficient for drawing any conclusions. The point, if I have
GH> understood it correctly, is that the use of $& *once* enables
GH> capturing for *all* regular expressions in the program, also those
GH> without capturing parentheses or capturing through $&.
to clarify that, $& is a way to capture the entire match. it is similar
to enclosing the regex in () and using $1. so by itself it is useful
(golfers like it :). but in order to work properly it has a global side
effect. since it always has the full match from the last regex, and it
is a global var, if you use it once ANYWHERE in your code, the matched
string (btw, this really only matters with s/// since it can change the
original string) must be copied for all s/// even if you don't have any
capturing parens. so in general, don't use it, use explicit capturing
parens which will only cause the s/// with them to copy the original
string.
the OP's wimpy test didn't even come close to showing this issue. it
would need to be something which did s/// without capturing and either
$& being mentioned or not. and it would need many more runs than 1 to
show the difference. of course benchmark.pm is the way to do that as
timing a script will show nothing but compiler time and has no accuracy
at the required level.
uri
------------------------------
Date: 5 Nov 2004 12:52:53 -0800
From: ali.baig@gmail.com (Ali)
Subject: A small Perl problem
Message-Id: <ccd5819e.0411051252.6bbcdbce@posting.google.com>
Hi,
I have this small program and its giving error at file handler when I
put -w option like /urs/bin/perl -w
Program is as following
/usr/bin/perl -w
sub ReadInputFile {
my $FileName = $_;
my @lines;
open(FILE_H, "./ $FileName") or die "Oopp";
@lines = <FILE_H>;
close(FILE_H);
return @lines;
}
my $File = "test";
my @P_lines = ReadInputFile($File);
I am using Perl 5.005.
Thanks
------------------------------
Date: Fri, 05 Nov 2004 17:06:03 -0500
From: wana <ioneabu@yahoo.com>
Subject: Re: A small Perl problem
Message-Id: <10onqvvi1j1ld4c@news.supernews.com>
Ali wrote:
> Hi,
>
> I have this small program and its giving error at file handler when I
> put -w option like /urs/bin/perl -w
> Program is as following
>
> /usr/bin/perl -w
>
> sub ReadInputFile {
> my $FileName = $_;
> my @lines;
> open(FILE_H, "./ $FileName") or die "Oopp";
> @lines = <FILE_H>;
> close(FILE_H);
> return @lines;
> }
>
> my $File = "test";
> my @P_lines = ReadInputFile($File);
>
> I am using Perl 5.005.
>
> Thanks
Both the local and remote server I am working on use version 5.8.3. I think
you really should upgrade.
------------------------------
Date: Fri, 05 Nov 2004 21:12:01 GMT
From: Ala Qumsieh <notvalid@email.com>
Subject: Re: A small Perl problem
Message-Id: <B0Sid.5135$zx1.4769@newssvr13.news.prodigy.com>
Ali wrote:
> sub ReadInputFile {
> my $FileName = $_;
I think you meant:
my $FileName = shift;
--Ala
------------------------------
Date: Fri, 05 Nov 2004 22:23:00 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: A small Perl problem
Message-Id: <parno09qhcf62s7gnutg5v2kv45bp6bc61@4ax.com>
On 5 Nov 2004 12:52:53 -0800, ali.baig@gmail.com (Ali) wrote:
>Hi,
Hi!
>I have this small program and its giving error at file handler when I
>put -w option like /urs/bin/perl -w
First of all, better
use warnings;
nowadays...
>Program is as following
>
>/usr/bin/perl -w
This can't be your program. Don't retype code, paste it.
>sub ReadInputFile {
> my $FileName = $_;
Isn't it that you mean
my $FileName = $_[0];
instead?
> my @lines;
> open(FILE_H, "./ $FileName") or die "Oopp";
^
^
Better use lexical FHs nowadays:
open my $fh, '<', $FileName or die "Oopps: $!";
Of course this is not exactly the same as you wrote. But I doubt that
you *do* want *that* space. And if you don't want it, then "./" is not
needed either.
> @lines = <FILE_H>;
> close(FILE_H);
No need for this if using lexical FHs
> return @lines;
>}
All in all this may have been
<$fh>; # return() implicit.
} # end of sub
> my $File = "test";
> my @P_lines = ReadInputFile($File);
>
>I am using Perl 5.005.
D'Oh! Some of the suggestions I gave you may not be adequate. Better
use a more recent perl, anyway.
PS: don't take this as a personal attack, but do a favor to yourself
and read some basic introduction to Perl...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 5 Nov 2004 21:16:07 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: A small Perl problem
Message-Id: <cmgqe3$8lc$1@news.simnet.is>
"Ali" <ali.baig@gmail.com> wrote in message
news:ccd5819e.0411051252.6bbcdbce@posting.google.com...
>
> I have this small program and its giving error at file handler when I
> put -w option like /urs/bin/perl -w
> Program is as following
>
> /usr/bin/perl -w
you probably mean:
#!/usr/bin/perl -w
>
> sub ReadInputFile {
> my $FileName = $_;
you probably want one of:
my ($FileName) = @_;
my $FileName = $_[0];
my $FileName = shift;
> my @lines;
> open(FILE_H, "./ $FileName") or die "Oopp";
from here, it looks like there is a space after the ./
also, you might want to use a more helpful error message
open(FILE_H, "< ./$FileName") or die "could not open
'./$FileName': $!";
> ...
>
> I am using Perl 5.005.
consider upgrading
gnari
------------------------------
Date: Fri, 05 Nov 2004 15:43:17 -0500
From: wana <ioneabu@yahoo.com>
Subject: Re: Array -> Reference to Hash of Arrays
Message-Id: <10onm4pldka97be@news.supernews.com>
Brad Baxter wrote:
> On Fri, 5 Nov 2004, Tom wrote:
>
>> Hope my subject is right !
>> Well, Here is what 'm trying to fight with
>>
>> How to create/add/delete/print an "Array which Refers to Hash of
>> Arrays"
>>
>> Array - List of test cases (Not-Unique)
>> Hash - Key: Test Case Iteration # (Unique)
>> Value: <More than one value> i.e Array
>>
>> E.g. One test case(ARRAY-ELEMENT) shall have more than one iterations
>> (HASH-KEY) and iteration results (HASH-VALUE). I'm fiddling with perl
>> datastructures on how to implement this.
>>
>> Let me know if this needs more explanation !
>>
>
> And you've read "perldoc perldsc" sections "HASHES OF ARRAYS" and "ARRAYS
> OF HASHES" and you're not sure how to put them together? What have you
> tried so far?
>
> Regards,
>
> Brad
@my_array;
%my_hash;
@my_main_array;
push @my_main_array, \%my_hash;
%{$my_main_array[0]}{\@my_array}++;
the hash value associated with key \@my_array would be 1 now, right? And if
I do:
push @my_main_array, \%my_hash;
%{$my_main_array[1]}{\@my_array}++;
I have a new hash as my second element of @my_main_array whose key is a
reference to a new array. In C++, this would not work the same because all
references to %my_hash and @my_array would just point to the same hash and
array. Is this right? the concept seems counter-intuitive and can be a
little confusing.
wana
------------------------------
Date: Fri, 05 Nov 2004 13:07:06 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Array -> Reference to Hash of Arrays
Message-Id: <etolldg9i1h.fsf@wilson.emschwar>
wana <ioneabu@yahoo.com> writes:
> @my_array;
> %my_hash;
> @my_main_array;
>
> push @my_main_array, \%my_hash;
> %{$my_main_array[0]}{\@my_array}++;
>
> the hash value associated with key \@my_array would be 1 now, right?
That would be the hash value associated with the stringified
representation of \@my_array. Hash keys are strings. From 'perldoc
perldata':
Hashes are unordered collections of scalar values indexed by their
associated string key.
So, anything that is not a string, that is used as a hash key, is
turned into one.
> And if
> I do:
>
> push @my_main_array, \%my_hash;
> %{$my_main_array[1]}{\@my_array}++;
>
> I have a new hash as my second element of @my_main_array whose key is a
> reference to a new array.
No. What you have is another reference to the same hash as in
$my_main_array[0]. Think about it this way: you took a reference to a
hash once, and got, well, a reference that points to that hash. Why,
when you take a reference to that same hash again, would you expect
that reference to point to a new hash?
Likewise, with \@my_array, you're stringifying the representation of
the arrayref, and using that as the key. Since $my_main_array[0]
points to the same hash as $my_main_array[1]; you've just incremented
the value indexed by that key in %my_hash.
> In C++, this would not work the same because all
> references to %my_hash and @my_array would just point to the same hash and
> array. Is this right?
That's exactly how it works in Perl, as well. I'm not quite sure how
a reading of 'perldoc perlreftut' or 'perldoc perlref' could give you
the impression that it worked the way you seem to think it works, but
if you can explain which bits are confusing, we might be able to
suggest better wording so that everyone can benefit from your
confusion.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Fri, 5 Nov 2004 15:16:17 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Array -> Reference to Hash of Arrays
Message-Id: <Pine.A41.4.58.0411051513470.41890@ginger.libs.uga.edu>
On Fri, 5 Nov 2004, wana wrote:
> Brad Baxter wrote:
>
[snip]
> > On Fri, 5 Nov 2004, Tom wrote:
> >
[snip]
>
> @my_array;
> %my_hash;
> @my_main_array;
>
> push @my_main_array, \%my_hash;
> %{$my_main_array[0]}{\@my_array}++;
>
> the hash value associated with key \@my_array would be 1 now, right? And if
> I do:
>
> push @my_main_array, \%my_hash;
> %{$my_main_array[1]}{\@my_array}++;
>
> I have a new hash as my second element of @my_main_array whose key is a
> reference to a new array. In C++, this would not work the same because all
> references to %my_hash and @my_array would just point to the same hash and
> array. Is this right? the concept seems counter-intuitive and can be a
> little confusing.
>
> wana
>
Are you the original poster? (i.e., Tom?)
Brad
------------------------------
Date: Fri, 05 Nov 2004 16:46:01 -0500
From: wana <ioneabu@yahoo.com>
Subject: Re: Array -> Reference to Hash of Arrays
Message-Id: <10onpqdrma2gi40@news.supernews.com>
Eric Schwartz wrote:
> wana <ioneabu@yahoo.com> writes:
>> @my_array;
>> %my_hash;
>> @my_main_array;
>>
>> push @my_main_array, \%my_hash;
>> %{$my_main_array[0]}{\@my_array}++;
>>
>> the hash value associated with key \@my_array would be 1 now, right?
>
> That would be the hash value associated with the stringified
> representation of \@my_array. Hash keys are strings. From 'perldoc
> perldata':
>
> Hashes are unordered collections of scalar values indexed by their
> associated string key.
>
> So, anything that is not a string, that is used as a hash key, is
> turned into one.
>
>> And if
>> I do:
>>
>> push @my_main_array, \%my_hash;
>> %{$my_main_array[1]}{\@my_array}++;
>>
>> I have a new hash as my second element of @my_main_array whose key is a
>> reference to a new array.
>
> No. What you have is another reference to the same hash as in
> $my_main_array[0]. Think about it this way: you took a reference to a
> hash once, and got, well, a reference that points to that hash. Why,
> when you take a reference to that same hash again, would you expect
> that reference to point to a new hash?
>
> Likewise, with \@my_array, you're stringifying the representation of
> the arrayref, and using that as the key. Since $my_main_array[0]
> points to the same hash as $my_main_array[1]; you've just incremented
> the value indexed by that key in %my_hash.
>
>> In C++, this would not work the same because all
>> references to %my_hash and @my_array would just point to the same hash
>> and
>> array. Is this right?
>
> That's exactly how it works in Perl, as well. I'm not quite sure how
> a reading of 'perldoc perlreftut' or 'perldoc perlref' could give you
> the impression that it worked the way you seem to think it works, but
> if you can explain which bits are confusing, we might be able to
> suggest better wording so that everyone can benefit from your
> confusion.
>
> -=Eric
I thought that I had read otherwise but I cannot find the source. A quick
re-read of perlreftut proves me wrong and reveals a possible solution to
save myself partially:
@my_array;
%my_hash;
@my_main_array;
push @my_main_array, {%my_hash};
%{$my_main_array[0]}{[@my_array]}++;
push @my_main_array, {%my_hash};
%{$my_main_array[1]}{[@my_array]}++;
Now, I am creating an anonymous hash initialized with %my_hash and pushing
it into @my_main_array. Then I am creating a new element in that hash with
the key being a reference to an anonymous array initialized with @my_array.
Then I repeat the process for the second element of @my_main_array.
Is it correct to use the '++' at the end to create a value for the hash?
Does this give it a value of one? I have seen this notation used commonly
with creating hash elements and I was not totally sure.
wana
------------------------------
Date: Fri, 05 Nov 2004 16:48:14 -0500
From: wana <ioneabu@yahoo.com>
Subject: Re: Array -> Reference to Hash of Arrays
Message-Id: <10onpuihr0bec97@news.supernews.com>
Brad Baxter wrote:
> On Fri, 5 Nov 2004, wana wrote:
>
>> Brad Baxter wrote:
>>
> [snip]
>> > On Fri, 5 Nov 2004, Tom wrote:
>> >
> [snip]
>
>>
>> @my_array;
>> %my_hash;
>> @my_main_array;
>>
>> push @my_main_array, \%my_hash;
>> %{$my_main_array[0]}{\@my_array}++;
>>
>> the hash value associated with key \@my_array would be 1 now, right? And
>> if I do:
>>
>> push @my_main_array, \%my_hash;
>> %{$my_main_array[1]}{\@my_array}++;
>>
>> I have a new hash as my second element of @my_main_array whose key is a
>> reference to a new array. In C++, this would not work the same because
>> all references to %my_hash and @my_array would just point to the same
>> hash and
>> array. Is this right? the concept seems counter-intuitive and can be a
>> little confusing.
>>
>> wana
>>
>
> Are you the original poster? (i.e., Tom?)
>
> Brad
No, just go by one name. I was just thinking out loud trying to work out
the problem for myself from what I know to see if I understood it and get
some help if I was wrong (which I am).
wana
------------------------------
Date: Fri, 05 Nov 2004 14:43:35 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Array -> Reference to Hash of Arrays
Message-Id: <etoekj89dko.fsf@wilson.emschwar>
wana <ioneabu@yahoo.com> writes:
> @my_array;
> %my_hash;
> @my_main_array;
>
> push @my_main_array, {%my_hash};
> %{$my_main_array[0]}{[@my_array]}++;
Argh, to quote (possibly apocryphally) Niels Bohr: "That isn't right.
It's not even wrong!"
Read my reply again, closer. $hash{[@array]} does NOT use the
reference to the anonymous array as a key! Hashes ONLY use strings as
keys! What you're doing first stringifies the reference, and then
uses THAT as the key to the hash. What this means is threefold:
1) You can't turn a stringified reference back into a reference
(possibly you could, with XS, I'm not sure, but see below).
2) Even if you could, since stringifying a reference doesn't increment
its refcount, it's possible-- likely, even-- that the thing thus
referred to wouldn't exist any longer.
3) You don't appear to be interested in reading what I have to say, or
you would have seen that I addressed that very topic as the VERY
FIRST thing I commented on!
I don't like it first of all when I spend time reading the docs
that they have on their very own hard drive to someone, but I like
it even less when I do so and they ignore me!
If you want to get help from people on this newsgroup, read the
docs FIRST, and ask questions about them if necessary, and READ
what people write when they correct you!
> Is it correct to use the '++' at the end to create a value for the hash?
That's perfectly fine; why souldn't it be?
> Does this give it a value of one?
It increments whatever value was there; if it was 0, (or undef, which
is 0 when treated as a number), it becomes one, yes; what do you think
happens?
> I have seen this notation used commonly
> with creating hash elements and I was not totally sure.
Did you think of reading the documentation, which already exists on
your hard drive, before asking other people to read it for you?
Everything you've wanted to know so far has been readily answered in
the perlref, perlreftut, and perldata manpages. I don't mind
explaining things you've read there, and didn't understand, but when
it seems that you haven't read them at all, it's very frustrating.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Fri, 05 Nov 2004 18:32:08 -0500
From: wana <ioneabu@yahoo.com>
Subject: Re: Array -> Reference to Hash of Arrays
Message-Id: <10oo01co9v7hi52@news.supernews.com>
Eric Schwartz wrote:
> wana <ioneabu@yahoo.com> writes:
>> @my_array;
>> %my_hash;
>> @my_main_array;
>>
>> push @my_main_array, {%my_hash};
>> %{$my_main_array[0]}{[@my_array]}++;
>
> Argh, to quote (possibly apocryphally) Niels Bohr: "That isn't right.
> It's not even wrong!"
>
> Read my reply again, closer. $hash{[@array]} does NOT use the
> reference to the anonymous array as a key! Hashes ONLY use strings as
> keys! What you're doing first stringifies the reference, and then
> uses THAT as the key to the hash. What this means is threefold:
>
> 1) You can't turn a stringified reference back into a reference
> (possibly you could, with XS, I'm not sure, but see below).
> 2) Even if you could, since stringifying a reference doesn't increment
> its refcount, it's possible-- likely, even-- that the thing thus
> referred to wouldn't exist any longer.
> 3) You don't appear to be interested in reading what I have to say, or
> you would have seen that I addressed that very topic as the VERY
> FIRST thing I commented on!
>
> I don't like it first of all when I spend time reading the docs
> that they have on their very own hard drive to someone, but I like
> it even less when I do so and they ignore me!
>
> If you want to get help from people on this newsgroup, read the
> docs FIRST, and ask questions about them if necessary, and READ
> what people write when they correct you!
>
>> Is it correct to use the '++' at the end to create a value for the hash?
>
> That's perfectly fine; why souldn't it be?
>
>> Does this give it a value of one?
>
> It increments whatever value was there; if it was 0, (or undef, which
> is 0 when treated as a number), it becomes one, yes; what do you think
> happens?
>
>> I have seen this notation used commonly
>> with creating hash elements and I was not totally sure.
>
> Did you think of reading the documentation, which already exists on
> your hard drive, before asking other people to read it for you?
> Everything you've wanted to know so far has been readily answered in
> the perlref, perlreftut, and perldata manpages. I don't mind
> explaining things you've read there, and didn't understand, but when
> it seems that you haven't read them at all, it's very frustrating.
>
> -=Eric
sorry. i'll do some more in-depth reading this weekend. i am really trying
hard, but I can do better. thank you for your help.
wana :(
------------------------------
Date: Fri, 5 Nov 2004 00:46:35 +0000
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Check POP3 E-mail
Message-Id: <b4vq52-666.ln1@osiris.mauzo.dyndns.org>
Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
> David Gale wrote:
> > Quoth A. Sinan Unur:
> >> wana wrote:
> >>>
> >>> my @message = ();
> >>
> >> There is no need to explictly initialize my variables.
> >
> > Nor does it hurt to do so,
It is a trivial waste of runtime, and a non-trivial waste of a reader's
time when they try to figure out *why* you're explicitly initializing
something which doesn't need it.
> > and is a good habit to get into,
Thus I would strongly disagree here. Write less code, unless that makes
things less clear.
> > in case
> > you're ever in an environment when you can't choose which language to
> > program in, and have to use something (say, C) which does not
> > implicitly initialize variables.
Know The Language You're Writing In. It *never* pays to carry habits
across from one language to another.
> > Of course, I always initialize my variables (in any language) simply
> > because I'm a control freak, and want to be darn certain I know
> > what's in there. ;-)
You do. Perl guarantees variables to be correctly initialized to what
you expect. If you don't trust Perl to leave $x undef after 'my $x;',
why do you trust it after 'my $x = undef;'?
> Not sure what you guys are talking about now. :)
>
> Does anything really get *initialized* by saying
No, well, not in any way that does not occur with 'my @array;'. Perl
does not have the concept of an explicit initializer, in the way that
(say) C does. Scalars are implicitly initialized to undef, arrays and
hashes to the 'empty foo'.
> my @array = ();
This statement creates a variable, with an implicit initialization (my
has both compile-time and run-time parts), and then assigns the empty
list to it (which is pointless, as it was just initialized to that). In
C, for instance,
char a = 'a';
is qualititatively different from
char a; a = 'a';
as the first will succeed if 'char' is changed to 'const char' but the
second will fail.
Ben
--
All persons, living or dead, are entirely coincidental.
ben@morrow.me.uk Kurt Vonnegut
------------------------------
Date: Fri, 5 Nov 2004 15:34:33 -0500
From: "David Gale" <dsgSPAMFILTER@alum.dartmouth.org>
Subject: Re: Check POP3 E-mail
Message-Id: <2v26jfF2eq4d0U1@uni-berlin.de>
Quoth Ben Morrow <usenet@morrow.me.uk>:
> Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
>> David Gale wrote:
>>> Quoth A. Sinan Unur:
>>>> wana wrote:
>>>>>
>>>>> my @message = ();
>>>>
>>>> There is no need to explictly initialize my variables.
>>>
>>> Nor does it hurt to do so,
>
> It is a trivial waste of runtime, and a non-trivial waste of a
> reader's time when they try to figure out *why* you're explicitly
> initializing something which doesn't need it.
Wait, you're saying that the perl interpretter doesn't just skip the
unnecessary assignment? That's a surprise to me; I've always had the
impression that perl optimizes fairly well (I've never had a problem with
its running speed), and since most early perl programmers were coming from
languages which did require explicit initialization, I would've expected
that this trivial optimization would've been one of the first features.
Granted, I haven't run any tests to see if there is, in fact, a noticeable
difference, but I'd be shocked to find there is one.
As for wasting a reader's time: a) Anyone as familiar with perl as you would
immediately realize that this is an extraneous hold-over, and thus not waste
any time wondering about the initialization; b) anyone not as wise and
experienced, or whose primary experience is in a different language,
wouldn't even notice the initialization as being out-of-place. In neither
case would it slow the reader down, and, in fact, can often aid in
interpretation--if I initialize a scalar to 0, then it's clear that I intend
that variable to be numeric; if I initialize it to '', then it's clear that
I intend to use it as a string. Granted, wise perl programmers like
yourself would know that 0 and '' are both false values, and thus
equivalent--but the lesser mortals would benefit from the extra tip. Think
of it as a small form of self-commenting code.
>>> and is a good habit to get into,
>
> Thus I would strongly disagree here. Write less code, unless that
> makes things less clear.
And, as argued above, I think that it does help keep things clear.
my $var;
my $var = 0;
my $var = '';
are all equivalent statements, but, as pointed out above, the first tells
you *nothing* about how the variable is intended to be used; that has to be
determined through code examination. The second and third, however, show
their purpose immediately.
>>> in case
>>> you're ever in an environment when you can't choose which language
>>> to program in, and have to use something (say, C) which does not
>>> implicitly initialize variables.
>
> Know The Language You're Writing In. It *never* pays to carry habits
> across from one language to another.
Ah, the great philosophy of, "If you can't become an instant expert in
whatever language your boss determines to be appropriate for the job, you
might as well flip burgers at the local burger joint." Code is code.
Often, habits that are helpful in one language are helpful in others--or do
you not use subroutines, because they are too similar to C's functions? I
terminate my lines in TCL with semi-colons, even though it's completely
superfluous to do so, because I think it makes it clearer, and it doesn't
slow TCL down at all. Proper code commenting should be a habit, regardless
of language; granted, the character sequence to delimit a comment changes,
but that doesn't change the fact that it's a good habit. And so on. That's
why most programming classes try to teach programming styles, rather than
specific language features--yes, it's great that I learned how to program
Dyllan. But if I couldn't transfer the skills and habits from there, I'd be
forced to start from scratch when dealing with Scheme, Lisp, etc.
I'll grant that there's one language which specifically *tried* to break
totally away from all previous languages (Intercal), but I've never seen
familiarity with that listed as a required skill on a job posting.
>>> Of course, I always initialize my variables (in any language) simply
>>> because I'm a control freak, and want to be darn certain I know
>>> what's in there. ;-)
>
> You do. Perl guarantees variables to be correctly initialized to what
> you expect. If you don't trust Perl to leave $x undef after 'my $x;',
> why do you trust it after 'my $x = undef;'?
I do, in perl. But not in most other languages. And, again, 'my $x;' tells
me nothing of the expected use of the variable, whereas 'my $x = 0;' does.
(Incidentally, 'my $x = undef;' suffers from the same problem, and so I
never use it. So, *in my opinion*, 'my $x;' and 'my $x = undef;' are both
equivalent unclear constructs, and ought to be avoided.)
------------------------------
Date: Fri, 5 Nov 2004 23:03:02 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 5.36: How do I select a random line from a file?
Message-Id: <cmh0r6$m58$1@reader1.panix.com>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
5.36: How do I select a random line from a file?
Here's an algorithm from the Camel Book:
srand;
rand($.) < 1 && ($line = $_) while <>;
This has a significant advantage in space over reading the whole file
in. You can find a proof of this method in *The Art of Computer
Programming*, Volume 2, Section 3.4.2, by Donald E. Knuth.
You can use the File::Random module which provides a function for that
algorithm:
use File::Random qw/random_line/;
my $line = random_line($filename);
Another way is to use the Tie::File module, which treats the entire file
as an array. Simply access a random array element.
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: Fri, 5 Nov 2004 15:45:49 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Finding consecutive lines
Message-Id: <Pine.A41.4.58.0411051542330.41890@ginger.libs.uga.edu>
On Fri, 5 Nov 2004, David K. Wall wrote:
> Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
>
> > On Fri, 5 Nov 2004, Peter wrote:
> >
> >> I need to parse a file looking for patterns in 5 consecutive
> >> lines. e.g.
> >>
> >> I want to find 5 consecutive lines with "abc" in first line,
> >> "def" in second, "efg" in third etc.
> >>
> [snip]
> >
> > #!/usr/bin/perl
> > use warnings;
> > use strict;
> >
> > my @f = qw( abc def ghi jkl mno );
> > my @s;
> > while( <DATA> ) {
> > push @s, $_;
> > shift @s if @s > 5;
> > next unless @s == 5;
> > print " @s\n" if
> > $s[0] =~ /$f[0]/ and
> > $s[1] =~ /$f[1]/ and
> > $s[2] =~ /$f[2]/ and
> > $s[3] =~ /$f[3]/ and
> > $s[4] =~ /$f[4]/;
> >}
>
> I like this a little better because it doesn't require maintenance if
> the number of patterns changes.
>
>
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my @buffer;
> my @pattern = qw(abc def ghi jkl mno);
> while (<DATA>) {
> push @buffer, $_;
> next if @buffer != @pattern;
> my $matches = grep /1/,
> map $buffer[$_] =~ /$pattern[$_]/,
> 0 .. $#pattern;
> print @buffer if $matches == @pattern;
> shift @buffer;
> }
>
I agree that's better. I see you also optimized away an unnecessary
comparison. :-)
Regards,
Brad
------------------------------
Date: Fri, 05 Nov 2004 22:05:49 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Finding consecutive lines
Message-Id: <0nqno0hs7etehp05p32tt0fl89okho630e@4ax.com>
On 5 Nov 2004 06:46:16 -0800, peter_holmes2003@yahoo.com (Peter)
wrote:
>I want to find 5 consecutive lines with "abc" in first line, "def" in second,
>"efg" in third etc.
>
>How can I do something like this..
Slurp the whole file in and use a regex! If the whole file is huge,
then maintain a buffer and join lines five at a time as you read new
ones.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 5 Nov 2004 14:35:29 -0600
From: "Matt" <nospam.hciss@yahoo.com>
Subject: Logging UDP Packets
Message-Id: <10onp0vpt0530ff@corp.supernews.com>
I wrote the following script to log UDP accounting packets to disk. I want
it to start everytime the Linux box boots up staying resident and logging
all UDP packets to disk. I am sure it used to work but now it no longer
logs the packets. What it does is log the date and source IP but not what
was actually in the packet. Any idea what I messed up here?
Matt
#!/usr/bin/perl -w
#udp logging
use IO::Socket;
use LWP::Simple;
use Time::localtime;
close(STDIN);
close(STDOU);
close(STDERR);
exit if (fork());
exit if (fork());
while (1){
my($sock, $msg, $PORTNO, $LPATH);
$PORTNO = 5151;
$LPATH = "/home/isp-logs/pppoe-logs/";
$sock = IO::Socket::INET->new(LocalPort => $PORTNO, Proto => 'udp')
or die "socket: $@";
print "awaiting UDP messages on port $PORTNO\n";
while ($sock->recv($msg, $MAXLEN)) {
$tm = localtime;
$time_stamp = sprintf "%04d-%02d-%02d %02d:%02d:%02d",
$tm->year + 1900, $tm->mon + 1, $tm->mday,
$tm->hour, $tm->min, $tm->sec;
$file_stamp = sprintf "%04d-%02d", $tm->year + 1900, $tm->mon + 1;
open(LOGFILE, ">>".$LPATH.$file_stamp.'.log') || die "cannot
open/create file: $!";
my($port, $ipaddr) = sockaddr_in($sock->peername);
$peeradr = gethostbyaddr($ipaddr, AF_INET);
print LOGFILE $time_stamp." ".$peeradr." "."$msg\n";
close(LOGFILE);
}
die "recv: $!";
}
------------------------------
Date: Fri, 05 Nov 2004 14:51:30 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Net::LDAP help
Message-Id: <nJRid.17$aX1.51812@news.uswest.net>
Just Curious wrote:
> Hello,
>
> I read on CPAN ( http://search.cpan.org/~gbarr/perl-ldap/lib/Net/LDAP.pod
> ) that in constructor for Net::LDAP - - new ( HOST, OPTIONS )
> HOST can be an array of hosts - each one is tried before undef is
> returned.
>
> I tried it and its not working for me - can anyone please provide an
> example how to use array of hosts with contsructor of Net::LDAP???
>
> Any pointers will be greatly appreciated.
>
> Regards,
>
> AZXML
From the documentation..
"HOST may also be a *reference* to an array of hosts"..
If you're using an array reference, then post what you've tried.
------------------------------
Date: Fri, 5 Nov 2004 22:51:13 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: Q: re Inline and Benchmark
Message-Id: <slrnconteh.o3.tassilo.von.parseval@localhost.localdomain>
Also sprach Sisyphus:
> 'sisyphus2()' despite addressing the "buffer duplication" issue, is
> about 4 times slower than 'sisyphus()'. This is because 'sv_insert()' is
> slow. Maybe there's a more efficient way of setting the characters of
> a SV to random values. If there is, then I couldn't find it, and we'll
> have to wait for someone else to tell us about it.
Why not just SvGROW the SV to the desired length and afterwards
i = 0;
while (i < l)
SvPVX(sv)[i++] = rand() % 256;
SvPVX returns the address of the C-string stored in the SV. Once you
know that the SV is at least a PV you can do it.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Fri, 5 Nov 2004 22:25:04 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Q: re Inline and Benchmark
Message-Id: <cmguk0$942$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Tassilo v. Parseval
<tassilo.von.parseval@rwth-aachen.de>], who wrote in article <slrncojf0m.pr.tassilo.von.parseval@localhost.localdomain>:
> >I would use something like
> >
> > outsv = sv_newmortal();
> > SvGROW(outsv, l);
> > str = SvPV_nolen(outsv);
> > ...
> > return outsv;
>
> Since SvGROW will upgrade a fresh SV to a PV, one could get away with
> just using SvPVX and thus save the ternary operation in SvPV_nolen. And
> again half a nanosecond is gained. ;-)
Right, this is what I do in tightmost loops. However, I think I
forgot to put SvCUR_set(outsv,l). (I did not check, but my vague
recolection is that SvGROW does not update SvCUR()...)
Yours,
Ilya
------------------------------
Date: Fri, 05 Nov 2004 15:20:00 -0600
From: bingster <bdu@iastate.edu>
Subject: remove unwanted parts from strings
Message-Id: <2v294bF2g7uuhU1@uni-berlin.de>
Hello,
If there is a string like this:
$test = 'a bc (B, M, D),d e (B, M),lfm (D)'
how can I remove all the '(*.)' parts to make it something like:
'a bc,d e,lfm'
I tried:
$test =~ s/\(*.\)//g;
But the result is 'a bc (B, M, ,d e (B, ,lfm '.
Thanks in advance for any help,
bingster
------------------------------
Date: Fri, 05 Nov 2004 21:38:14 +0100
From: Wanja Chresta <barachielNOSPAM@gmx.net>
Subject: Re: remove unwanted parts from strings
Message-Id: <418bf1d4$1_2@news.tiscalinet.ch>
> $test =~ s/\(*.\)//g;
Try
$test =~ s/\s*\(.*?\)\s*//g;
\s* stands for 0 or more (*) whitespaces (\s) (to remove leading spaces)
.*? means: 0 or more (*) chars (.) but match as less as possible (or you
will remove all from first "(" to last ")" )
And again \s* to remove tailing whitespaces
------------------------------
Date: Fri, 05 Nov 2004 16:31:32 -0600
From: Lars Eighner <eighner@io.com>
Subject: Re: remove unwanted parts from strings
Message-Id: <slrnconvlp.2rao.eighner@goodwill.io.com>
In our last episode,
<2v294bF2g7uuhU1@uni-berlin.de>,
the lovely and talented bingster
broadcast on comp.lang.perl.misc:
> Hello,
> If there is a string like this:
> $test = 'a bc (B, M, D),d e (B, M),lfm (D)'
> how can I remove all the '(*.)' parts to make it something like:
> 'a bc,d e,lfm'
> I tried:
> $test =~ s/\(*.\)//g;
This doesn't do what you think. I think you have got *. where you
meant .*, but even correcting that won't do what you think.
As you have written it above, you are looking to match zero or more
(s followed by any single character, followed by ). This will remove
the (D) at the end of your string and all the )s with the character
that precedes them.
> But the result is 'a bc (B, M, ,d e (B, ,lfm '.
Exactly.
Now I don't know whether when you wrote *. it was a typo for .* or
whether you are really confused about what * and . mean. But let's
try it the other way, in case it was a typo.
You may have meant:
$test =~ s/\(.*\)//g;
which says match on ( followed by zero or more of any character
followed by ).
But the result in this case would be 'a bc '. You see REGULAR
EXPRESSIONS ARE GREEDY (write this in stone), which means they
will match the biggest string they can. And the biggest match
here begins with the first ( and ends with the last ). But that
is not what you want. You want to match the first ( and everything
up to and including the first ), and then you want to match the
second ( and everything up to and including the second ) and so
forth.
So try this:
$test =~ s/\([^)]*\)//g;
This says, match a ( followed by zero or more characters that
are not ) and then a ). Notice that you do not escape the ) in
the square brackets because ) is not special in square brackets
- the characters that are special in square brackets are -]\^$
.
This gives you:
a bc ,d e ,lfm
which isn't quite what you want because you want the leading space
with (s out too, if there is one, but it is a step in thr right direction.
In order to remove that white space character if there is one, this
will work (you may want to adjust it if you have more than one white
space character or if you really only want to remove space characters
and not any white space character):
$test =~ s/\s?\([^)]*\)//g;
This gives you:
a bc,d e,lfm
which is exactly what you asked for:
> $test = 'a bc,d e,lfm'
I believe there are other ways to make regular expressions less
greedy, and perhaps some of them are better, but this makes sense
to me.
--
Lars Eighner -finger for geek code- eighner@io.com http://www.io.com/~eighner/
If it wasn't for muscle spasms, I wouldn't get any exercise at all.
------------------------------
Date: Fri, 05 Nov 2004 16:27:49 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Solaris taking over Perl ownership
Message-Id: <Ge6dndqaodzKbRbcRVn-oQ@comcast.com>
Andrew Hamm wrote:
> Hi folks
>
> I have recently built a Perl 5.8.5 binary for a new customer. I have made
> it install in /usr/bin, /usr/lib etc
>
> As many of you are probably aware, Solaris are supplying and obsolete
> version of Perl in /usr/bin/perl etc. As you are may also be aware, it is
> an old version - for Solaris 9 you are happily supplied 5.6.1, and for
> Solaris 8 you are supplied (I think) approx 5.005.
>
> Now the customer, who self-admittedly has very little UNIX experience, is
> saying that Solaris is making threats of withdrawn support if we install a
> "non-Sun" version of Perl in the same location; overriding the obsolete
> version of Perl supplied by Sun. They are threatening total withdrawal of
> support for Solaris, not just "support" of Perl [if the story is to be
> believed]
He is correct. Overwriting your OS-supplied copy of Perl is very bad
practice; you can break the OS-supplied Perl scripts doing that.
>
> I believe that the customer has talked to an undergraduate teenager on the
> helpdesk who is making unofficial policy on the fly. It's also possible
> that some member of the customer has invented this story to put up a
> roadblock because they want the project to fail.
>
> However, disregarding these latter two possibilities; if Solaris is indeed
> making threats of this nature, what would the Perl community think? Has
> anyone else heard such outrageous claims from Sun?
>
> I am trying to get hold of a written statement from Sun confirming this
> stance, and if I obtain it I will post it here.
There's nothing out of the ordinary or unreasonable about any of this. The
answer, if you want an up-to-date Perl, is to install a second perl
somewhere else, say /usr/local/lib/perl5. Solaris even makes this easy
for you by putting its own perl in /usr/perl5. /usr/bin/perl is a link
to /usr/perl5/bin/perl and all the system scipts go to the native location,
so you can even link /usr/bin/perl to your perl and not break anything.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Fri, 05 Nov 2004 22:07:43 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Spurious "Use of uninitialized value" with -w, redux
Message-Id: <dpqno0t652cvh53pfo561lqdo870i5o4u5@4ax.com>
On Fri, 05 Nov 2004 15:25:06 GMT, samwyse <dejanews@email.com> wrote:
>to find one. That usually indicates a failure on my part, but in this
>case I also am using 'use strict;' and it, too, fails to find anything
>wrong when the '-w' option is removed. Either there's a very subtl
As a side note C<use strict;> and C<use warnings;> are to a large
extent orthogonal. Hence your claim doesn't make *much* sense...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 7366
***************************************