in reply to How to read from STDIN?

good excerise on it's own, but also note that File::Find::Rule is a use-existing-code approach:
my @all_files = File::Find::Rule->file()->maxdepth(1)->in($dir); # or my @matching_files = File::Find::Rule->grep( qr/foo/ )->file()->maxdep +th(1)->in($dir);