[31791] in Perl-Users-Digest
Perl-Users Digest, Issue: 3054 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 31 14:09:25 2010
Date: Sat, 31 Jul 2010 11:09:09 -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 Sat, 31 Jul 2010 Volume: 11 Number: 3054
Today's topics:
Re: Can this be done (by a noob :)) <thomas@tifozi.net>
Re: Can this be done (by a noob :)) <thomas@tifozi.net>
Re: Can this be done (by a noob :)) <tadmc@seesig.invalid>
Re: Can this be done (by a noob :)) <thomas@tifozi.net>
Re: Can this be done (by a noob :)) <tadmc@seesig.invalid>
Re: Can this be done (by a noob :)) <thomas@tifozi.net>
Re: Can this be done (by a noob :)) <sherm.pendley@gmail.com>
Re: Can this be done (by a noob :)) <ben@morrow.me.uk>
Re: Can this be done (by a noob :)) <jurgenex@hotmail.com>
Re: Can this be done (by a noob :)) <jurgenex@hotmail.com>
Re: Can this be done (by a noob :)) <thomas@tifozi.net>
Re: Can this be done (by a noob :)) <thomas@tifozi.net>
Re: Can this be done (by a noob :)) <sherm.pendley@gmail.com>
Re: Can this be done (by a noob :)) <sherm.pendley@gmail.com>
Re: Can this be done (by a noob :)) <thomas@tifozi.net>
Re: Can this be done (by a noob :)) sln@netherlands.com
Re: Can this be done (by a noob :)) <jurgenex@hotmail.com>
Re: Can this be done (by a noob :)) <uri@StemSystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 31 Jul 2010 13:48:15 +0200
From: "Thomas Andersson" <thomas@tifozi.net>
Subject: Re: Can this be done (by a noob :))
Message-Id: <8bigokFn79U1@mid.individual.net>
Sherm Pendley wrote:
> You had originally written something like this:
>
> while ($page) {
> if ($page) {
> # do stuff
> } else {
> }
> }
>
> Since the while() loop repeats only if $page evaluates to a true
> value, you don't need to check $page again with an if(). If $page is
> false, the body of the loop will not execute at all, so by the time
> you reach the line that the if() is on, you already know that $page
> is true. So, the if() block will always run, and the else block never
> will; that being the case, it's simpler to just omit the if():
Ah, I realized that afterwards while looking over the code. That if/then bit
was a leftover from a example script I found and is now gone as it serves no
purpose in my script. Next thing I need to add is a check for the exit
conditions. Thinking about using $page as condition might be a bad idea, how
about it checking for a signal variable to be set? Inside the loop code
would run untill my exit conditions are meet and then it sets the signal
variable telling the loop to end? The two conditions would be finding a
either of two strings within the captured page (either a sid we already know
or the string "No more sorties").
------------------------------
Date: Sat, 31 Jul 2010 14:14:29 +0200
From: "Thomas Andersson" <thomas@tifozi.net>
Subject: Re: Can this be done (by a noob :))
Message-Id: <8bii9mFvumU1@mid.individual.net>
Uri Guttman wrote:
>>>>>> "TA" == Thomas Andersson <thomas@tifozi.net> writes:
> so you need to put some conditionals in the loop. first, how would you
> know when the pages are done? can you look for a link to the next page
> and exit the loop if it isn't there? then define what a 'processed
> link' is. keep track (likely in a hash) of processed links and if you
> find one exit the loop. exiting a loop is easy, use the last function.
They've been quite helpfull there as the empty pages contain the string "No
more sorties". The other condition is trickier, I need to load a variable at
the same time as the pid that tells the last processed sid, when that sid is
found no further pages needs to be loaded (the whole point of capturing
these list pages is so we can extract all sids we find in them for further
processing).
> use less comment. make your comments mean something outside the
> code. code is what, comments are why. and you are writing code to be
> read by a maintainer. always keep that person in your mind and your
> code will be better for it.
Well, I only started learning perl a day ago and the comments are mostly for
my own sake to remind me what I'm doing as most of this stuff is still
pretty voodoo to me.
> have you ever heard of white space? jamming lines of code together
> makes major migraines when reading it. loosen up a little. blank
> lines between sections is a good idea.
Rodger that, will do.
>> open PIDLIST, "<", $pidfile or die "Could not open $pidfile: $!";
>> my $pid = <PIDLIST>;
>> print $pid; # print just so we know we have a pid to process.
>
> comments on the code line are a poor idea in most cases. when they are
> long comments it is a horrible idea.
OK, will stop doing that then.
>> chomp $pid; # Remove endline from pid.
>
> again, you are telling us what you just did. redundant to anyone who
> knows what chomp is.
Ok, but as I said before, I'm learning and those comments are only for my
own information to help me learn. Once it's done I can go over and remove
all thsoe comments and put something more useful in.
>> my $page = get "$pbase?page=$pcnt&pid=$pid";
>> while ($page) {
>
> bah. it is not clear why you are testing page in the loop. and you
> have two duplicate lines with the get. make it an infinite loop and
> exit when the get fails.
Yeah, that's a big bug with my code and I know about it. The idea was to
keep loading pages untill there was no more, but that idea failed as the
server keeps serving empty pages with ever higher page numbers. Another
solution for finding a loop ender is needed and I have two requirements that
each should end it.
>> # Create file for storing pages containing the sids.
>> my $tmpf = "c:/scr/$pid.txt";
>> open TEMPF, ">>", $tmpf or die "Could not open $tmpf: $!";
>> print TEMPF $page; # Store grabbed webpage into the file
>
> you can do that with getstore or use File::Slurp's write_file (from
> cpan).
>
> use File::Slurp ;
>
> write_file( "c:/scr/$pid.txt", $page ) ;
> much easier to read.
Definitely, so that one call replaces all 3 of my lines? Butwill I get a
error message like prrevious if it fails?
> here is a better loop:
>
> while( 1 ) {
>
> my $page = get "$pbase?page=$pcnt&pid=$pid";
> last unless $page ;
> write_file( "c:/scr/$pid.txt", $page ) ;
> }
>
> short, easy to read, easy to maintain. now you can add in the checks
> for exiting the loop and it will be easier.
Hmm, as I'm noob I don't quit get it, but I think it's allong the lines I
mentioned in another message. I assume a non failure signals 1? and I need
to set anything but inside the loop to exit it? But what do I set? it has no
variable name?
------------------------------
Date: Sat, 31 Jul 2010 08:08:03 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Can this be done (by a noob :))
Message-Id: <slrni587tc.nop.tadmc@tadbox.sbcglobal.net>
Thomas Andersson <thomas@tifozi.net> wrote:
> Uri Guttman wrote:
>> here is a better loop:
>>
>> while( 1 ) {
>>
>> my $page = get "$pbase?page=$pcnt&pid=$pid";
>> last unless $page ;
>> write_file( "c:/scr/$pid.txt", $page ) ;
>> }
>>
>> short, easy to read, easy to maintain. now you can add in the checks
>> for exiting the loop and it will be easier.
>
> Hmm, as I'm noob I don't quit get it, but I think it's allong the lines I
> mentioned in another message. I assume
No need to assume, just look it up in the docs for the function
you are using:
perldoc LWP::Simple
The get() function will fetch the document identified by the
given URL and return it. It returns "undef" if it fails.
> a non failure signals 1?
A non-failure stores the contents of the page in $page (a true value).
A failure stores an undef in $page (a false value).
You should probably avoid using the word "signal" unless you
are talking about signals. That is, the term has a particular
meaning to programmers:
http://en.wikipedia.org/wiki/Signal_%28computing%29
> and I need
> to set anything but inside the loop to exit it?
No.
$page will contain undef (false) when the get() fails.
"unless" executes its statement when the condition is false.
So, when get() fails, "last" is evaluated and the loop will be exited.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: Sat, 31 Jul 2010 15:51:16 +0200
From: "Thomas Andersson" <thomas@tifozi.net>
Subject: Re: Can this be done (by a noob :))
Message-Id: <8binukF1s8U1@mid.individual.net>
Tad McClellan wrote:
>> a non failure signals 1?
>
> A non-failure stores the contents of the page in $page (a true value).
> A failure stores an undef in $page (a false value).
Prob is it will never fail, the server keeps feeding pages with no content
in so a test needs to be added inside the loop.
Would the following code help exiting the loop?
if ( $page eq $endstring ) {
exit( 0 );
};
($endstring = "No more sorties" which is the string replacing data in emprty
pages).
------------------------------
Date: Sat, 31 Jul 2010 08:54:26 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Can this be done (by a noob :))
Message-Id: <slrni58akb.nt6.tadmc@tadbox.sbcglobal.net>
Thomas Andersson <thomas@tifozi.net> wrote:
> Tad McClellan wrote:
>
>>> a non failure signals 1?
>>
>> A non-failure stores the contents of the page in $page (a true value).
>> A failure stores an undef in $page (a false value).
>
> Prob is it will never fail, the server keeps feeding pages with no content
> in so a test needs to be added inside the loop.
> Would the following code help exiting the loop?
>
> if ( $page eq $endstring ) {
> exit( 0 );
> };
>
> ($endstring = "No more sorties" which is the string replacing data in emprty
> pages).
No that will never work unless this is the "web page" that is returned:
No more sorties
Most web pages will have tags and newlines and whatnot in them,
so an equality test will not work. A pattern match would work though:
last if $page =~ /No more sorties/;
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: Sat, 31 Jul 2010 16:02:33 +0200
From: "Thomas Andersson" <thomas@tifozi.net>
Subject: Re: Can this be done (by a noob :))
Message-Id: <8biojoF5o0U1@mid.individual.net>
Tad McClellan wrote:
>> if ( $page eq $endstring ) {
>> exit( 0 );
>> };
>>
>> ($endstring = "No more sorties" which is the string replacing data
>> in emprty pages).
>
> No that will never work unless this is the "web page" that is
> returned:
>
> No more sorties
Doh, stupid me, of course, thanks!
> Most web pages will have tags and newlines and whatnot in them,
> so an equality test will not work. A pattern match would work though:
>
> last if $page =~ /No more sorties/;
That's clean and nice, if inserted before the page is saved I won't have to
deal with useless pages! :)
Thank you very much sir!
------------------------------
Date: Sat, 31 Jul 2010 10:03:16 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: Can this be done (by a noob :))
Message-Id: <m2fwyzvjdn.fsf@sherm.shermpendley.com>
"Thomas Andersson" <thomas@tifozi.net> writes:
> Would the following code help exiting the loop?
Exit() exits the *program*. In this case, since your loop is basically
the whole program, it amounts to the same thing, but that won't always
be the case! Better to use last - that's what it's for.
> if ( $page eq $endstring ) {
last;
> };
>
> ($endstring = "No more sorties" which is the string replacing data in emprty
> pages).
Is it sent as plain text, without even a newline character at the end?
I doubt that - more likely, it's an HTML page that *contains* that
string. That being the case, you could use the index() function to see
if $endstring appears anywhere in $page:
if ( index($page, $endstring) == -1 ) {
last;
}
sherm--
--
Sherm Pendley <www.shermpendley.com>
<www.camelbones.org>
Cocoa Developer
------------------------------
Date: Sat, 31 Jul 2010 15:13:56 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Can this be done (by a noob :))
Message-Id: <4mndi7-eve2.ln1@osiris.mauzo.dyndns.org>
Quoth "Thomas Andersson" <thomas@tifozi.net>:
> > Also: get into the habit, now, of keeping you filehandles in proper
> > variables. It will make life easier later.
> >
> > open my $FILE, ">", "..." or ...;
>
> Will definitely try to pick up good habbits on coding and formatting so
> thanks for advice.
> But if I createa variable of the filehandler like this, won't it contain the
> filepath then, so when I do the print $FILE it will print the filepath
> instead of the content of the file as I want? Or am I missunderstanding?
> (quite likely).
Yes, you are misunderstanding. If you create $FILE like that, it will
contain a filehandle. If you then want to print to that filehandle, you
do it like
print $FILE "one two three\n";
(Note the lack of comma after $FILE: that's important).
If you want to print $FILE itself, you can:
print $FILE; # this is short for print STDOUT $FILE
and you will get something like 'GLOB(0xDEADBEEF)'.
Ben
------------------------------
Date: Sat, 31 Jul 2010 07:57:53 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Can this be done (by a noob :))
Message-Id: <otd856l48dge6ds1gvb4ersvdo7uj0derr@4ax.com>
"Thomas Andersson" <thomas@tifozi.net> wrote:
>Next thing I need to add is a check for the exit
>conditions. Thinking about using $page as condition might be a bad idea, how
>about it checking for a signal variable to be set? Inside the loop code
>would run untill my exit conditions are meet and then it sets the signal
>variable telling the loop to end?
Why does this remind me of the typical poor approaches of first year
Computer Science students? :-)
No, this is almost always a Very Bad Idea(TM). Setting flags like that
quickly leads to very hard to maintain code.
I have not idea what your exit criterion is, but you should loop while
it is not met
while (!exit_criterion(whateverArgYouNeedToComputeIt)
Perl also gives you an additional function "last" which will exit the
loop immediately. It is a nice pragmatic shortcut, although programming
purists frown upon it.
jue
------------------------------
Date: Sat, 31 Jul 2010 08:02:10 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Can this be done (by a noob :))
Message-Id: <hie8565vsqjmsucq8ic59re0gk52g59ki6@4ax.com>
"Thomas Andersson" <thomas@tifozi.net> wrote:
>Prob is it will never fail, the server keeps feeding pages with no content
>in so a test needs to be added inside the loop.
Then obviously you are using the wrong condition for your loop.
>Would the following code help exiting the loop?
>
> if ( $page eq $endstring ) {
> exit( 0 );
> };
>
>($endstring = "No more sorties" which is the string replacing data in emprty
>pages).
If this is the end condition for the loop then it would help even more
if your put it in the condition for the loop.
while (........ and ($page ne $endstring)) {
jue
------------------------------
Date: Sat, 31 Jul 2010 17:28:18 +0200
From: "Thomas Andersson" <thomas@tifozi.net>
Subject: Re: Can this be done (by a noob :))
Message-Id: <8bitk1F3dhU1@mid.individual.net>
Jürgen Exner wrote:
> Why does this remind me of the typical poor approaches of first year
> Computer Science students? :-)
Well, I'm a one day hobbie studier so same same ;)
> No, this is almost always a Very Bad Idea(TM). Setting flags like that
> quickly leads to very hard to maintain code.
OK, good to know.
> I have not idea what your exit criterion is, but you should loop while
> it is not met
> while (!exit_criterion(whateverArgYouNeedToComputeIt)
>
> Perl also gives you an additional function "last" which will exit the
> loop immediately. It is a nice pragmatic shortcut, although
> programming purists frown upon it.
The loop has been rewritten and workds as intended now, using last to exit
on the two possible conditions. Now look like this:
while (1) {
my $page = get "$pbase?page=$pcnt&pid=$pid";
last if $page =~/No sorties/;
# Store grabbed webpage into the file
append_file( "c:/scr/$pid.txt", $page ) ;
last if $page =~/"sid=$lproc"/;
# Update page number and grab next.
$pcnt++;
};
------------------------------
Date: Sat, 31 Jul 2010 17:33:44 +0200
From: "Thomas Andersson" <thomas@tifozi.net>
Subject: Re: Can this be done (by a noob :))
Message-Id: <8bitu6F5a8U1@mid.individual.net>
Sherm Pendley wrote:
> Exit() exits the *program*. In this case, since your loop is basically
> the whole program, it amounts to the same thing, but that won't always
> be the case! Better to use last - that's what it's for.
It will make a difference as this is only part of the program I need to do.
I'm using last now.
> Is it sent as plain text, without even a newline character at the end?
> I doubt that - more likely, it's an HTML page that *contains* that
> string. That being the case, you could use the index() function to see
> if $endstring appears anywhere in $page:
>
> if ( index($page, $endstring) == -1 ) {
> last;
> }
I'm currently using:
last if $page =~/No sorties/;
Which seems to do the trick, is there a downside to using my solution?
------------------------------
Date: Sat, 31 Jul 2010 11:39:32 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: Can this be done (by a noob :))
Message-Id: <m24off7j9n.fsf@sherm.shermpendley.com>
Jürgen Exner <jurgenex@hotmail.com> writes:
> If this is the end condition for the loop then it would help even more
> if your put it in the condition for the loop.
>
> while (........ and ($page ne $endstring)) {
It's a judgement call. Sometimes, especially if there are several con-
ditions, it can make more sense to use last:
while(foo && bar && baz)
while(1) {
last unless foo;
last unless bar;
last unless baz;
...
}
Which form to use is best judged on a case-by-case basis, with the
goal being readability.
sherm--
--
Sherm Pendley <www.shermpendley.com>
<www.camelbones.org>
Cocoa Developer
------------------------------
Date: Sat, 31 Jul 2010 11:46:27 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: Can this be done (by a noob :))
Message-Id: <m2zkx764do.fsf@sherm.shermpendley.com>
"Thomas Andersson" <thomas@tifozi.net> writes:
> Sherm Pendley wrote:
>
>> That being the case, you could use the index() function to see
>> if $endstring appears anywhere in $page:
>>
>> if ( index($page, $endstring) == -1 ) {
>> last;
>> }
>
> I'm currently using:
> last if $page =~/No sorties/;
> Which seems to do the trick, is there a downside to using my solution?
Not really, either will work just as well.
sherm--
--
Sherm Pendley <www.shermpendley.com>
<www.camelbones.org>
Cocoa Developer
------------------------------
Date: Sat, 31 Jul 2010 17:55:58 +0200
From: "Thomas Andersson" <thomas@tifozi.net>
Subject: Re: Can this be done (by a noob :))
Message-Id: <8biv7pFcl6U1@mid.individual.net>
Sherm Pendley wrote:
> Which form to use is best judged on a case-by-case basis, with the
> goal being readability.
Ok, in my case I have two conditions and I want to end loop in different
ways for each so I think the last version will work for me (If empty page
exit before storing it, if it contains the last processed I still need to
store it so do that and then exit).
Your advice and examples really help and is appreciated!
Best Wishes
Thomas
------------------------------
Date: Sat, 31 Jul 2010 09:35:27 -0700
From: sln@netherlands.com
Subject: Re: Can this be done (by a noob :))
Message-Id: <n4i856tid15n5tfvn3n2aq392111mjpt1e@4ax.com>
On Sat, 31 Jul 2010 17:28:18 +0200, "Thomas Andersson" <thomas@tifozi.net> wrote:
>Jürgen Exner wrote:
>
>> Why does this remind me of the typical poor approaches of first year
>> Computer Science students? :-)
>
>Well, I'm a one day hobbie studier so same same ;)
>
>> No, this is almost always a Very Bad Idea(TM). Setting flags like that
>> quickly leads to very hard to maintain code.
>
>OK, good to know.
>
>> I have not idea what your exit criterion is, but you should loop while
>> it is not met
>> while (!exit_criterion(whateverArgYouNeedToComputeIt)
>>
>> Perl also gives you an additional function "last" which will exit the
>> loop immediately. It is a nice pragmatic shortcut, although
>> programming purists frown upon it.
>
>The loop has been rewritten and workds as intended now, using last to exit
>on the two possible conditions. Now look like this:
>
>while (1) {
> my $page = get "$pbase?page=$pcnt&pid=$pid";
> last if $page =~/No sorties/;
> # Store grabbed webpage into the file
> append_file( "c:/scr/$pid.txt", $page ) ;
> last if $page =~/"sid=$lproc"/;
> # Update page number and grab next.
> $pcnt++;
>};
>
my $sid_rx = qr/sid=$lproc/i;
for my $pid (1 .. 4)
{
my $fname = "c:/scr/$pid.txt";
open my $FHpid, ">>", $fname or die "Can't open $fname: $!";
my $pnumb = 1;
while (defined( my $page = get( "$pbase?page=$pnumb&pid=$pid")) and
$page !~ /No sorties/i )
{
# Store webpage
print $FHpid $page,"\n";
last if $page =~ /$sid_rx/;
# Update page number, get next.
$pnumb++;
}
close $FHpid;
}
------------------
Beware that if $page is generated html,
using a regex on it as in
$page !~ /No sorties/i
$page =~ /$sid_rx/
can be done, but only after it is parsed.
It can be parsed with regex's ... though,
thats beyond the scope of this post and another
thing entirely.
But, if you don't care, then its ok.
-sln
------------------------------
Date: Sat, 31 Jul 2010 09:42:29 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Can this be done (by a noob :))
Message-Id: <m0k856tqrbkm7l5mmtubhdqb9df5g63i90@4ax.com>
"Thomas Andersson" <thomas@tifozi.net> wrote:
>Jürgen Exner wrote:
>The loop has been rewritten and workds as intended now, using last to exit
>on the two possible conditions. Now look like this:
>
>while (1) {
Ouch, this hurts! Usually this line indicates a deamon which is never
supposed to terminate.
> my $page = get "$pbase?page=$pcnt&pid=$pid";
> last if $page =~/No sorties/;
> # Store grabbed webpage into the file
> append_file( "c:/scr/$pid.txt", $page ) ;
> last if $page =~/"sid=$lproc"/;
> # Update page number and grab next.
> $pcnt++;
>};
Why not move the loop condition into the loop condition?
my $page = get "$pbase?page=$pcnt&pid=$pid";
while ((!$page =~/No sorties/) and (!$page =~/"sid=$lproc"/)) {
append_file( "c:/scr/$pid.txt", $page );
$pcnt++;
$page = get "$pbase?page=$pcnt&pid=$pid";}
}
Yes, I know the condition could be formulated better, but I transformed
it as little as possible to demonstrate how the exit() cond can
trivially be moved into the while() cond.
BTW: space characters are very cheap, I just saw a them on sale at
Costco. Fell free to use as many as you like to make your code more
readable.
jue
------------------------------
Date: Sat, 31 Jul 2010 13:50:53 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Can this be done (by a noob :))
Message-Id: <87mxt7fsle.fsf@quad.sysarch.com>
>>>>> "JE" == Jürgen Exner <jurgenex@hotmail.com> writes:
>> while (1) {
JE> Ouch, this hurts! Usually this line indicates a deamon which is never
JE> supposed to terminate.
not in my book. it just means an infinite loop. check inside for calls
to last. fine with me and remember, i told him to do this! :)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 V11 Issue 3054
***************************************