K
Klaus
I am trying to match a literal string '{0,0}' using the syntax m{...}.
I know that I have to escape both the '{' and '}' characters.
Here is my program
========================
use strict;
use warnings;
$_ = '{0,0}';
if (m{\A\{0,0\}\z}) {
print "yes\n";
}
else {
print "no\n";
}
========================
The regexp works as intended and prints "yes", but there is an
unexplained warning message:
========================
Quantifier unexpected on zero-length expression in regex; marked by
<-- HERE in m/\A{0,0}\z <-- HERE / at Testregexp.pl line 5.
yes
========================
The message does not appear if I use /\A\{0,0\}\z/.
It seems to me that Perl is confused about using '{' and '}' inside a
match of the form m{...}
I am using Activestate Perl 5.10 on Windows XP.
C:\>perl -v
This is perl, v5.10.0 built for MSWin32-x86-multi-thread
(with 5 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 1004 [287188] provided by ActiveState http://www.ActiveState.com
Built Sep 3 2008 13:16:37
I know that I have to escape both the '{' and '}' characters.
Here is my program
========================
use strict;
use warnings;
$_ = '{0,0}';
if (m{\A\{0,0\}\z}) {
print "yes\n";
}
else {
print "no\n";
}
========================
The regexp works as intended and prints "yes", but there is an
unexplained warning message:
========================
Quantifier unexpected on zero-length expression in regex; marked by
<-- HERE in m/\A{0,0}\z <-- HERE / at Testregexp.pl line 5.
yes
========================
The message does not appear if I use /\A\{0,0\}\z/.
It seems to me that Perl is confused about using '{' and '}' inside a
match of the form m{...}
I am using Activestate Perl 5.10 on Windows XP.
C:\>perl -v
This is perl, v5.10.0 built for MSWin32-x86-multi-thread
(with 5 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 1004 [287188] provided by ActiveState http://www.ActiveState.com
Built Sep 3 2008 13:16:37