Greg McCarroll <[EMAIL PROTECTED]> writes:

> * Piers Cawley ([EMAIL PROTECTED]) wrote:
> > David Cantrell <[EMAIL PROTECTED]> writes:
> > > On Tue, Jan 09, 2001 at 11:25:18AM +0000, Greg McCarroll wrote:
> > > >         6.) regular expressions are not the only way to code, length and
> > > >             substr are in the language for a reason
> > > 
> > > Also index.  These two snippets are equivalent:
> > >   if($foo=~/foo/) { ... }
> > >   if(index($foo, 'foo')!=-1) { ... }
> > > I always want to do just plain if(index(...)) though.
> > 
> > ISTR that (for weird reasons), the regex version of that is faster.
> 
> but of course we don't (shouldn't) program perl for program time
> optimization but for programmer time optimization ;-)

So the regex wins on all counts then. Faster, clearer, shorter, easier
to maintain. The list goes on.

-- 
Piers


Reply via email to