A Shortcut
- This loop is so common that Perl has a shortcut for it:
while ( <STDIN> ) {
print "The line is -> $_";
}
- Won't work if you put anything else into that line!
- Not the same as foreach (<STDIN>)
| CPU: Perl, Fall 2005 | Perl, Week 4: More Arrays, Context, Subroutines, Lexical Variables | #10 |
while ( <STDIN> ) {
print "The line is -> $_";
}
| Copyright © 2005 Ian Langworth |