M
Matt Taylor
I have a little program below, but it's not printing what I'm expecting. I
checked and double-checked the docs, but it doesn't look like I'm doing
anything wrong. Initially tried this in 5.6, upgraded to 5.8, then tried it
on another machine running 5.005, and all 3 produce this erroneous output.
Could anyone lend a little insight? My program gets into an infinite loop
because it never actually parses anything.
$foo = "blah";
$foo =~ m/(h)/gc;
print "pos=", pos, "\n";
# Expected: pos=4
# Actual: pos=
# Perhaps pos is undef?
pos() = 0;
$foo = "blah";
$foo =~ m/(h)/gc;
print "pos=", pos, "\n";
# Expected: pos=4
# Actual: pos=0
$_ = "blah";
m/(h)/gc;
# Expected: pos=4
# Actual: pos=4
-Matt
checked and double-checked the docs, but it doesn't look like I'm doing
anything wrong. Initially tried this in 5.6, upgraded to 5.8, then tried it
on another machine running 5.005, and all 3 produce this erroneous output.
Could anyone lend a little insight? My program gets into an infinite loop
because it never actually parses anything.
$foo = "blah";
$foo =~ m/(h)/gc;
print "pos=", pos, "\n";
# Expected: pos=4
# Actual: pos=
# Perhaps pos is undef?
pos() = 0;
$foo = "blah";
$foo =~ m/(h)/gc;
print "pos=", pos, "\n";
# Expected: pos=4
# Actual: pos=0
$_ = "blah";
m/(h)/gc;
# Expected: pos=4
# Actual: pos=4
-Matt