http://www.perlmonks.org?node_id=996


in reply to Basic I/O Exercises

# 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; }