use strict; use warnings; use Getopt::Std; use Data::Dump::Streamer; testSwitches (qw(-p -q)); testSwitches (qw(-s)); testSwitches (qw(-t)); testSwitches (qw(-s -t)); testSwitches (qw(-p)); sub testSwitches { local @ARGV = @_; my %opt; my $test; print join (' ', @ARGV), "\n"; getopt ('st', \%opt); Dump \%opt; print "\n"; } #### -p -q $HASH1 = { p => 1, q => 1 }; -s $HASH1 = { s => undef }; -t $HASH1 = { t => undef }; -s -t $HASH1 = { s => '-t' }; -p $HASH1 = { p => 1 }; #### if (! exists $opt{s} and ! exists $opt{t}) {