foreach my $file_spec ( @ARGV ) { my @files = glob( $file_spec ); foreach my $file ( @files ) { if ( not(-e $file) and ( $file =~ /[.*]/ ) ) # change as appropriate { warn "Error: file $f doesn't exist," . " or wildcard didn't match, " unless -e $file; } } }