print "File(s): "; my $fileSpec= or exit(0); my @files= map { glob($fileSpec) or (warn "No files matching $fileSpec found.\n")[()]; } split ' ', $fileSpec; foreach my $file ( @files ) { #...