SWITCH: for (ref $param) { /HASH/ && do { # Do something for hash ref last SWITCH; }; /^$/ && do { # Do something for scalar last SWITCH; }; }