perl ./script.pl $(ls *.txt | sed 's/^/-file /') #### perl ./script.pl -file myfile.txt -file yourfile.txt -file ourfile.txt #### #!/usr/bin/perl use strict; use warnings; use Getopt::Long qw (GetOptions); my (@Files); Getopt::Long::Configure("no_ignore_case", "prefix_pattern=(--|-|\/)"); GetOptions ("file=s@" => \@Files); my @globs = map {glob ($_)} @Files; print "glob: $_\n" for @globs; #### ./script.pl -file "*.txt" #### ./script.pl -file "*.txt" #### myfile.txt yourfile.txt ourfile.txt #### ./script.pl -file myfile.txt -file yourfile.txt -file ourfile.txt #### myfile.txt yourfile.txt ourfile.txt