# really simple: my $debug = ( @ARGV and $ARGV[0] eq '-d' ) ? shift : ''; # or, more in the style of getopt: my %opt; while ( @ARGV and $ARGV[0] =~ /^-([dv])$/ ) { $opt{$1} = 1; shift; }