#!/usr/bin/perl my @file = qx/cat file/; chomp ($file[$#file]) if $file[$#file] =~ m/\s+/;