use Getopt::Std; getopts('fs', \%opts); #### if ($opts{s}) { #do stuff } #### Global symbol "%opts" requires explicit package name..... #### { package FOO; use Getopt::Std; getopts('fs', \%opts); }