I get a page full of output from a command passed into a Net::Telnet session
that as per the cpan example is stored in $output. I then want to call a sub
passing $output into it, that matches a string against each line, and sets a
a var to "OK" if the match is successful.
All is well, but I am unclear on the correct way to loop through each line in
$output, when I simply print it, it appears over several lines in the terminal.
When I run it into my sub, its being treated as one line?
sub parse_output {
foreach (@_) {
chomp($_);
print "Line: $_\n";
if ( $_ =~ /$match/ ) {
$status = "OK";
next;
}
}
}
parse_output($output);
It only prints one "Line:" although it works as it sets $status?
What am I missing?
Thanks!
jlc
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/