foreach (qw( -845 4/3 1.25 )) { /^[-+]?\d{3}$/ && do { print("$_ is a three digit integer, with a possible sign.\n"); #next; }; /^-/ && do { print("$_ starts with a minus sign\n"); #next; }; /\// && do { print("$_ has a / in it.\n"); #next; }; } __END__ output ====== -845 is a three digit integer, with a possible sign. -845 starts with a minus sign 4/3 has a / in it.