use Getopt::Long; my ( $timeout, $show_help ) = 30; unless ( GetOptions("timeout|t=i" => \$timeout, "help|h|?" => \$show_help) && $show_help ) { error_info(); }