Blob
1 #!/usr/bin/perl3 #Write a program that acts like cat, but reverses the order of the output4 #lines. (Some systems have a utility like this named tac.) If you run yours as5 #./tac fred barney betty, the output should be all of file betty from last line6 #to first, then barney, and then fred, also from last line to first. (Be sure7 #to use the ./ in your program's invocation if you call it tac so that you8 #don't get the system's utility instead!)11 use v5.10;12 use warnings;13 use strict;14 use utf8;16 #my @lines;17 #foreach (@ARGV) {18 # open my $fh, '<', $_;19 # push @lines, <$fh>;20 # close $fh;21 #}22 #print reverse @lines;23 print reverse <>;