$cat = 'ata'; SWITCH: for ($cat) # make $_ = $cat, you could do it by hand { # syntaxt # whatever test on $_ && do { $this = 'if test passed'; last;}; (length $_ > 1) && do { die "\$cat must be one letter not: `$cat'"; last;}; /t/ && do { $catfile = "notitec.html"; last; }; /a/ && do { $catfile = "notiagro.html"; last; }; /d/ && do { $catfile = "notideportes.html"; last; }; /h/ && do { $catfile = "notihogar.html"; last; }; /r/ && do { $catfile = "notirecrea.html"; last; }; /s/ && do { $catfile = "notisociales.html"; last; }; die "unknown value for \$cat: `$cat'"; # could just as easily be the default value }