Reading Line-by-Line
- STDIN in scalar context returns undef when there aren't any lines left
while ( defined( $line = <STDIN> ) ) {
print "The line is -> $line";
}
| CPU: Perl, Fall 2005 | Perl, Week 4: More Arrays, Context, Subroutines, Lexical Variables | #9 |
while ( defined( $line = <STDIN> ) ) {
print "The line is -> $line";
}
| Copyright © 2005 Ian Langworth |