1*0Sstevel@tonic-gate#!./perl 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateprint "1..4\n"; 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gate$x='banana'; 6*0Sstevel@tonic-gate$x=~/.a/g; 7*0Sstevel@tonic-gateif (pos($x)==2) {print "ok 1\n"} else {print "not ok 1\n";} 8*0Sstevel@tonic-gate 9*0Sstevel@tonic-gate$x=~/.z/gc; 10*0Sstevel@tonic-gateif (pos($x)==2) {print "ok 2\n"} else {print "not ok 2\n";} 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gatesub f { my $p=$_[0]; return $p } 13*0Sstevel@tonic-gate 14*0Sstevel@tonic-gate$x=~/.a/g; 15*0Sstevel@tonic-gateif (f(pos($x))==4) {print "ok 3\n"} else {print "not ok 3\n";} 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gate# Is pos() set inside //g? (bug id 19990615.008) 18*0Sstevel@tonic-gate$x = "test string?"; $x =~ s/\w/pos($x)/eg; 19*0Sstevel@tonic-gateprint "not " unless $x eq "0123 5678910?"; 20*0Sstevel@tonic-gateprint "ok 4\n"; 21*0Sstevel@tonic-gate 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gate 24