use warnings; use strict; my $PATH = '/tmp/foo'; opendir my $dh, $PATH or die $!; print "\"$_\"\n" for grep { -f "$PATH/$_" && /^([0-9][\w.:,=\-]+)$/ } readdir $dh; closedir $dh; __END__ "1231125716.6864.bLyyk:2,S" "123test" "1422830161.R3.asus64:2,S"