Regex in global variable of package fails

0 views
Skip to first unread message

Heinz Knutzen

unread,
Aug 13, 2010, 4:29:56 PM8/13/10
to perl-c...@googlegroups.com
This test program fails with B::C.
It needs a separate package to exploit the failure.

Test4.pm:
=====
package Test4;
my $regex = qr/\w+/;
sub test {
print "$regex\n";
print ("word" =~ m/^$regex$/o ? "Match\n" : "No match\n");
}
1
=====

test4.pl:
=====
use Test4;
&Test4::test();
=====

Expected output:
$ perl test4.pl
(?-xism:\w+)
Match

With B::C, regex match fails:
$ perlcc -o test4 test4.pl
$ ./test4
Regexp=SCALAR(0x804c5c0)
No match

--
Heinz Knutzen

Reply all
Reply to author
Forward
0 new messages