>>>>> "GB" == Graham Barr <[EMAIL PROTECTED]> writes:

  GB> On Wed, Aug 16, 2000 at 10:49:16AM -0500, Jarkko Hietaniemi wrote:
  >> On Wed, Aug 16, 2000 at 04:41:33PM +0100, Graham Barr wrote:
  >> > On Wed, Aug 16, 2000 at 10:20:28AM -0500, Jonathan Scott Duff wrote:
  >> > > > m//gt would be defined to do the match, and return the count of matches, 
this 
  >> > > > leaves all existing uses consistent and unaffected.  /t is suggested for
  >> > > > "counT", as /c is already taken.  Using /t without /g would be result in
  >> > > > only 0 or 1 being returned, which is nearly the existing syntax.
  >> > > 
  >> > > Better would be to redefine what m//g means in a scalar context. 
  >> > > 
  >> > >        $_ = "foofoofoofoofoofoofoo";
  >> > >        $count = m/foo/g;
  >> > > 
  >> > > 1 is just as true as 7.
  >> > 
  >> > But you would loose the functionality of \G starting where the last match
  >> > left off. This is very useful.
  >> 
  >> /gg to "count 'em all"? :-)

  GB> Fine with me.

might as well use a different modifier like the proposed /t. this is not
like /ee which does the eval twice. you can't do 'global' twice.

another point might be to make /g and /t in scalar context mutually exclusive
(fatal error) since /g means remember where we matched for the next time
and /t means count all the matches.

uri

-- 
Uri Guttman  ---------  [EMAIL PROTECTED]  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

Reply via email to