use Getopt::Std; getopts ("ab:"); print "a exists\n" if $opt_a; print "b = $opt_b\n" if $opt_b;