1N/A#!./perl
1N/A
1N/Aprint "1..4\n";
1N/A
1N/A$x='banana';
1N/A$x=~/.a/g;
1N/Aif (pos($x)==2) {print "ok 1\n"} else {print "not ok 1\n";}
1N/A
1N/A$x=~/.z/gc;
1N/Aif (pos($x)==2) {print "ok 2\n"} else {print "not ok 2\n";}
1N/A
1N/Asub f { my $p=$_[0]; return $p }
1N/A
1N/A$x=~/.a/g;
1N/Aif (f(pos($x))==4) {print "ok 3\n"} else {print "not ok 3\n";}
1N/A
1N/A# Is pos() set inside //g? (bug id 19990615.008)
1N/A$x = "test string?"; $x =~ s/\w/pos($x)/eg;
1N/Aprint "not " unless $x eq "0123 5678910?";
1N/Aprint "ok 4\n";
1N/A
1N/A
1N/A