in reply to Variable Sub Calls

On switching, there's a very stylish way to do it in Perl, with which many people aren't familiar. The two are synonyms:
if ($foo =~ /p1/) { do1; } elsif ($foo =~ /p2/) { do2; } elsif ($foo =~ /p3/) { do3; } else { do4; } SWITCH: for ($foo) { /p1/ && do1 && last; /p2/ && do2 && last; /p3/ && do3 && last; do4; }