use Getopt::Std; use strict; my %opts; getopts("pf:t:", \%opts); foreach my $key (keys %opts) { my $value=$opts{$key}; print "$key=>$value\n"; } print "\n\@ARGV: ", join(",", @ARGV), "\n";
perl getopt.pl -p -f input.txt -t "this is a test" arg1 arg2 moreoutput
p=>1 f=>input.txt t=>this is a test @ARGV: arg1,arg2,more