use Getopt::Long; GetOptions(\%opt, "d=s", "i=s") or die "usage..."; # the options are now in $opt{d} and $opt{i}