in reply to Re: /g matches not really global in scalar context!
in thread /g matches not really global in scalar context!
Don’t confuse yourself. foreach puts its expression into list context, so a /g match actually returns a list of all matches at once; of course the foreach then iterates over them one by one. The loop construct you want is while, which evaluates its condition in scalar context, so a /g match as the condition will return matches one by one.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: /g matches not really global in scalar context!
by jonix (Friar) on Nov 14, 2005 at 14:37 UTC |