in reply to Matching First Character of Strings Efficiently
Will call expensive_function only on items that start with 'Foo' (Which can be limited to one character if thats what you Really want)my $str_a = 'Foo'; # Can be any length for my $str_b (grep /^$str_a/, @list ) { # Can + be any number of items expensive_function($str_a , $str_b); }
Update: This is the same as delirium's solution, above.
Offense, like beauty, is in the eye of the beholder, and a fantasy.
By guaranteeing freedom of expression, the First Amendment also guarntees offense.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Matching First Character of Strings Efficiently
by Limbic~Region (Chancellor) on Mar 15, 2004 at 20:10 UTC |