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

[MacPerl] m/\G/g, Postscriptum



Earlier this week I posted a question about /\G//g
with the example which looked a lot like the one below.
This example is from the perlop.pod file from the 5.1.4r4
package; this example works, but this time a /c modifier
was added to /g. The Camel(2) Book,the Owl book and the 
perlop.html don't mention this special modifier.



      # using m//gc with \G
      $_ = "ppooqppqq";
      while ($i++ < 2) {
          print "1: '";
          print $1 while /(o)/gc; print "', pos=", pos, "\n";
          print "2: '";
          print $1 if /\G(q)/gc;  print "', pos=", pos, "\n";
          print "3: '";
          print $1 while /(p)/gc; print "', pos=", pos, "\n";
      }

  The last example should print:

      1: 'oo', pos=4
      2: 'q', pos=5
      3: 'pp', pos=7
      1: '', pos=7
      2: 'q', pos=8
      3: '', pos=8

Gert Kok

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