# Untested # Use a printf/scanf pattern to match file names use String::Scanf qw(); use File::Find::Rule; my @w = qw( . ); # where to look my $f = $ARGV[0]; $f =~ s/[\012\015]+$//; # universal chomp() my $r = String::Scanf::format_to_re($f); my @files = File::Find::Rule->file() ->name( $r ) ->in( @w );