# Read lines until a line consisting only of "." is seen. # Then print the lines back out in the opposite order. my @lines; while ( $line = <> and $line ne ".\n" ) { push @lines, $line; } foreach ( reverse @lines ) # only reverses the list used by foreach; d +oes not modify the array { print; }
In reply to Basic I/O #2
by vroom
in thread Basic I/O Exercises
by vroom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |