On Thu, 24 Jan 2002 14:58:09 -0500, [EMAIL PROTECTED] (Michael G
Schwern) wrote:

> On Thu, Jan 24, 2002 at 11:24:47AM -0500, Bill -OSX- Jones wrote:
> > $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.

But you can't just take them off since you'd need to put a comma in
then:

    $c = grep /[osx]/i, @_;

or perhaps even

    $c = grep /[osxOSX]/, @_;

ISTR someone saying that matching /[fF][oO][oO]/ was better than /foo/i,
but that might be apocryphal; I'm not sure which effect, if any, that
would have on the relative speeds of /[osx]/i and /[osxOSX]/.

Cheers,
Philip

Reply via email to