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); } }
In reply to Re: Passing regular expressions as arguments to subroutines
by johnnywang
in thread Passing regular expressions as arguments to subroutines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |