in reply to Passing regular expressions as arguments to subroutines
my $a = qr/turtle|fish/i; foo($a); sub foo{ my $reg = shift; if(ref($reg) eq 'Regexp'){ my $string = 'fisH'; print "hello" if ($string =~ $reg); } } [download]