{ my %opt; getopts("hf:d:") || die HELP(); sub opt_h { exists $opt{h} ? 1 : 0 } sub opt_f { exists $opt{f} ? 1 : 0 } sub opt_d { exists $opt{d} ? 1 : 0 } } #### { my %opt; getopts("hf:d:") || die HELP(); sub opt_h { exists $opt{h} ? 1 : 0 } sub opt_f { exists $opt{f} ? $opt{f} : '' } sub opt_d { exists $opt{d} ? $opt{d} : '' } } if ( opt_f eq "foo" ) { ... } # usw, etc.