F
Frank Seitz
use strict;
use warnings;
use Scalar::Util;
my $ref = qr/x/;
print 'Test1: ',ref($ref),"\n";
$ref = bless $ref,'X';
print 'Test2: ',ref($ref),"\n";
print 'Test3: ',Scalar::Util::reftype($ref),"\n";
__END__
Test1: Regexp
Test2: X
Test3: SCALAR
How do I recognize a regex reference?
ref() works only with unblessed references.
reftype() doesn't help.
Any ideas?
Frank
use warnings;
use Scalar::Util;
my $ref = qr/x/;
print 'Test1: ',ref($ref),"\n";
$ref = bless $ref,'X';
print 'Test2: ',ref($ref),"\n";
print 'Test3: ',Scalar::Util::reftype($ref),"\n";
__END__
Test1: Regexp
Test2: X
Test3: SCALAR
How do I recognize a regex reference?
ref() works only with unblessed references.
reftype() doesn't help.
Any ideas?
Frank