in reply to Get fullpath of file using grep
or use glob.
my @files = glob ("$dir/*.dat $dir/*.DAT"); [download]
But watch out for directory names that contain spaces, you may need to use bsd_glob instead.