[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Troubles while using m/\G/ g...



G_L_H_Kok@fbw.vu.nl writes:
>I wanted to know more about regexp's in combination with /g, and
>tried the following example from an 5.004 perlop page;
># using m//g with \G
>$_ = "ppooqppq";
>while ($i++ < 2) {
>    print "1: '";
>    print $1 while /(o)/g; print "', pos=", pos, "\n";

You're looping *until* the match fails, and after a failed match, pos will
return nothing.

Matthias

-----
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "I'm set free to find a new illusion" -- Velvet Underground

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch