my $fc = substr($str_a,0,1); for my $str_b ( @list ) { next if ord($fc) == ord((split(//, $str_b))[0]); expensive_function ( $str_a, $str_b ); }