$ cat t.pl #!/usr/bin/perl use strict; use warnings; while () { my @f = split /\s+/, $_; my $last = pop @f; print $last, "\n"; } __DATA__ the quick red fox jumped over the lazy brown dog. Now is the time for all men to come to the aid of their party. $ perl t.pl fox lazy is all to their party.