in reply to Re^3: passing regular expression
in thread passing regular expression
my $digit = '\d'; /$digit/; only compiles a regexp once as well.
Perhaps, but that's not the OP's usage.
my $digit = qr/\d/; foo($digit); # Compiles once my $digit = '\\d'; foo($digit); # Compiles any number of times
Whether or not passing a pattern as a compile regexp or as string is faster depend on what the subroutine is doing with it.
I said that in the post to which you are replying.
|
|---|