#!/usr/bin/perl -w use strict; my ($myfile, @LINES); open $myfile, "file" or die "Unable to open file: $!\n"; push @LINES, $_ for (<$myfile>); #print "$_" for @LINES; chomp ($LINES[$#LINES-1]) if ( $LINES[$#LINES] =~ m/\s+/ ); #print "$_" for @LINES; #### #!/usr/bin/perl my @file = qx/cat file/; chomp ($file[$#file]) if $file[$#file] =~ m/\s+/;