When it needs to create various choises according to someone variable it’s reasonable to build a shitch block: sub test { my $var = shift; SWITCH: for($var) { /^1$/ && do { do something for case 1 … ; last SWITCH;}; /^2$/ && do { do something for case 2 … ; last SWITCH;}; /^3$/ && do { do something for case 3 … ; […]