in reply to Matching First Character of Strings Efficiently

Untested:

my $str_a = 'Foo'; my $fc = substr($str_a,0,1); expensive_function($str_a, $_) for grep {! /^$fc/o} @list;

Replies are listed 'Best First'.
Re: Re: Matching First Character of Strings Efficiently
by Limbic~Region (Chancellor) on Mar 15, 2004 at 20:01 UTC
    delerium,
    As I stated, you are not allowed to change the looping construct. See the comment that says # only change this. I will include this solution (combination of substr and a regex) into the benchmark list though.

    Cheers - L~R