Its the same logic - continue after first substitution/match.
In case of subst.. it continues and in case of regex, the search
continues after first match until the complete string is exhausted

On 30 May 2007 22:54:39 -0700, jeevs <[EMAIL PROTECTED]> wrote:

> $ perl -wle'
> $string = "abc";
> while ($string =~ /(.*?)/g) {
>   print pos($string), ": ", $1;}
>
> '
> 0:
> 1: a
> 1:
> 2: b
> 2:
> 3: c
> 3:
>
Can someone explain the working of the g modifier since my knowledge
of using g was to use it for substituting globally...
Here i get what paul is trying to explain but if i take out g from the
statement why does it say use of uninitialized value and prints
nothing.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to