# get rid of trailing whitespace chomp $rest; # split on consecutive whitespace # (includes tabs and mult spaces) @rest_ary = split(/\s+/, $rest); # grab last item $pass = $rest_ary[$#rest_ary]; print "pass = $pass\n"; # just to double check - for ($x = 0; $x <= $#rest; $x++) { print "array item $x = $rest[$x]\n"; }