use Getopt::Std; our($opt_p); getopt('p'); my $arg = $opt_p; getopts('p'); my $switch = $opt_p; print "Switch is $switch and arg is $arg\n";