http://qs321.pair.com?node_id=963204


in reply to Reading from a glob into Getopt::Long

On unixish shells, it is the shell, not your program that expands globs. The customary approach to handle this situation is to process @ARGV (instead of @files) after GetOpt has taken all switches away:

GetOptions( ... ); my @files = @ARGV; ... rest of program ...

The alternative approach would be to quote the glob on the command line to prevent the shell from expanding it:

> myprog.pl --filespec '*.mp3'

... and afterwards expand it in your program using File::Glob or whatever globbing semantics you want to provide.