#!/usr/bin/perl use strict; use warnings; my @array = ('-rw-r--r-- user/group 41733 2006-04-17 23:19:00 files/sa03.tex', '-rw-r--r-- user/group 16406 2006-04-18 00:57:16 files/sa04.tex', '-rw-r--r-- user/group 6313 2006-04-17 23:28:22 files/sa05.tex', '-rw-r--r-- user2/group 3284 2006-04-13 21:11:10 files/sa06.tex', '-rw-r--r-- user2/group 14014 2006-04-13 19:25:50 files/sa07.tex', '-rw-r--r-- user2/group 4062 2003-11-18 15:44:34 files/twola ng.sty'); for my $entry(@array){ my $filename = (split(/\s+/,$entry,6))[-1]; print $filename,"\n"; }