sub test($) { my $s = shift; print $s =~ /^[xyz]*$/ ? "$s matches\n" : "$s does not match\n"; }