in the post that i am now replying to, i said that i couldn't get
the program to skip lines as it parsed through the output of another
program.
i have "solved" the problem- but i do not know WHY this works the
way it does.
<SNIP>
this worked great :) (thanks to drieux) - in fact, it would let
me have several programs input to this one at once :) (if i'm not mistaken)
>open (CMD , "$command|") or die "Could not execute $command : $!";
>
>parse_and_extract($pattern,$skip,$table);
>
>close CMD;
<SNIPPED for brevety>
>
>sub skip_lines {
> my $lines = shift; #number of lines in file to skip over
>
> print "in skip_lines() $_ before skip\n"; #debug
>
> #<CMD> for 1..$lines; #not functioning...
>
> for (0..$lines){
> my $trash = <CMD>;
> print "trash is $trash \n"; #debug
> }
the fix was to replace the above for loop with the following::
for my $trash (0..$lines) {
$_ = <CMD>;
print "the line skipped is $_\n"; #debug
}
> print "in skip_lines() $_ after skip\n"; #debug
>
>}
well- i don't understand it. WHY does this work?
if someone could clarify the mechanics behind this behaviour,
i would be very grateful!
thank you much,
willy
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>