#!/usr/bin/perl 2: 3: #this program prompts a user for the name of a source file 4: #and then reads from the file line by line. Once it is done 5: #reading the file it prints the lines of the file in reverse order 6: 7: print "What is the name of the source file? "; 8: $file=<>; 9: chomp($file); 10: open FILE, "<$file"; 11: while(){ 12: push @lines,$_; 13: } 14: foreach(reverse @lines){ 15: print $_; 16: } 17: close FILE; #### #!perl -w use strict; my $file; print "Enter a filename: "; chomp ( $file = ); open ( FILE, "$file" ); for (reverse ()){ print; } close FILE;