#!/usr/bin/perl $path = "path to the directory"; chomp($path); chdir($path); @lis = `ls`; foreach (@lis) { if ($_ =~ m/^dump*txt$/) #say the file i want is dump_234_129_15.txt { print $_."\n"; } }