On Thu, Jan 24, 2002 at 11:24:47AM -0500, Bill -OSX- Jones wrote: > >>$c = grep {/[osx]/i} @_; > >> > >>Is there a better way? > > > >To do... what? > > Sorry - > > Given: > > $_ = "Mac OS X"; > > split //; > $c = grep {/[osx]/i} @_;
Regardless, the {} there is redundant and actually slows you down a bit (Perl has to enter/leave that block on each element which isn't cheap and its not smart enough to optimize it out. > print "Found $c things\n"; print "Mac OS X" =~ tr/osxOSX//; -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One There is nothing here But a lip of hardened paste >From our night of joy. -- ignatz