in reply to m//g behaves strange...
I had recently answered a post, Re: An Insane Typo Bug, and it relates to your question in an interesting way. The original post in that thread has a totally different face with your wonder, but both are about the same fact that, in scalar context, m// returns either 1 or 0.
For pos(), try this, it gives you 1 and 9, so pos() does work:
use strict; use warnings; $_ = "0123456789"; my $ret = m/0/g; print "ret = $ret, pos = " . pos() . "\n"; $ret = m/8/g; print "ret = $ret, pos = " . pos() . "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: m//g behaves strange...
by Anonymous Monk on Nov 10, 2003 at 03:08 UTC | |
by pg (Canon) on Nov 10, 2003 at 03:59 UTC | |
by tye (Sage) on Nov 10, 2003 at 05:50 UTC | |
by !1 (Hermit) on Feb 26, 2004 at 18:59 UTC | |
by tye (Sage) on Feb 26, 2004 at 19:19 UTC | |
by pg (Canon) on Nov 10, 2003 at 06:27 UTC | |
by Anonymous Monk on Nov 10, 2003 at 06:54 UTC | |
| |
by tye (Sage) on Nov 10, 2003 at 15:34 UTC |