sub { # After validating that the regex is really a regex. my $string = 'fish'; print "hello" if ($string =~ $_[0]); # prints hello }