use Getopt::Std; getopt('oDI'); # -o, -D & -I take arg. Sets opt_* as a side effect. getopts('oif:'); # -o & -i are boolean flags, -f takes an argument. # Sets opt_* as a side effect. ***** getopt('dV'); ***** myscr -bfd January -V 10.4 ***** $opt_b = 1; $opt_f = 1; $opt_d = "January"; $opt_V = 10.4; ***** myscr -bfdJanuary -V10.4 ***** getopts('a:bc:'); ***** myscr -abc # WRONG unless bc is really the argument that belongs with -a myscr -a -bc # WRONG, with same qualification myscr -a foo -bc bar # $opt_a = "foo"; $opt_b = 1; $opt_c = "bar" myscr -bafoo -cbar # same as previous ***** use strict; use vars qw($opt_o $opt_i $opt_D); use Getopt::Std;