my %ArgumentState(); foreach (@ARGV) { SWITCH: for ($_) { /^a/i && do { $ArgumentState{'foo'}='bar'; last; }; /^b/i && do { &Do_something_here; last; }; }; };