Reverse file in Perl

#!/usr/bin/perl -w

use strict;
use warnings;

open FILE, "<".$ARGV[0];
my @LINES = <FILE>;

for(my $i = scalar(@LINES) - 1; $i >= 0; $i--)
{
    print $LINES[$i];
}
This entry was posted in Generale. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>