in reply to Re: Dumping Compiled Regular Expressions
in thread Dumping Compiled Regular Expressions
You can bless a reference to a reference, which is what I'm starting to prefer. Your way works just as well, but I think it's more clear to say:
my $re = qr/(test)io; # added captures for the example my $class = 'Test'; my $regex = bless(\$re, $class); # bless a reference to the compile +d regex my $data = "testing!"; if ($data =~ /$$regex/) { print "Found $1!\n"; } print ref($regex), "\t", ref($$regex), "\n";
|
|---|