in reply to Get fullpath of file using grep

or use glob.

my @files = glob ("$dir/*.dat $dir/*.DAT");

But watch out for directory names that contain spaces, you may need to use bsd_glob instead.