What drives me nuts is it returns "xx.txt" if "xx.txt" was passed to the "glob" even if "xx.txt" does not exist.While that can be frustrating if it doesn't DWIM, I can think of a use for it.
You might want to know which wildcard didn't match.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; } } }
-QM
--
Quantum Mechanics: The dreams stuff is made of
In reply to Re: Re: Re: Globbing drives me nuts - some things seem counterintuitive
by QM
in thread Globbing drives me nuts - some things seem counterintuitive
by Sandy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |