sub test { my $s = shift; if ( $s =~ /^[xyz]+$/ ) { print "$s matches\n"; return; } print "$s doesn't match\n"; }