use Getopt::Std; my %opts; getopts('h', \%opts); help() if $opts{h};