http://qs321.pair.com?node_id=1009


in reply to File Input and Output Exercises

# prompt the user for the name of a source file, and # read all the lines from that file. # Then print out the lines in reverse order. print "What is the name of the source file? "; my $file = <>; chomp $file; open FILE, "< $file" or die "error reading $file - $!"; while ( <FILE> ) { push @lines, $_; } close FILE; foreach ( reverse @lines ) { print; }