[mplspm]: In a sorted list [better]

Thomas Eibner thomas at stderr.net
Fri Mar 22 09:49:58 CST 2002


On Fri, Mar 22, 2002 at 04:48:04PM +0100, Thomas Eibner wrote:
> If he just wants to know if it's in there or not why go through the first
> for loop and consume that memory? (After all he says up to 2 million
> strings)
> 
> my $found = 0;
> CHECK: for (@list) {
>     if ($_ eq 'string') {
>         $found = 1;
>         last CHECK;
>     }
> }

[Not saying that Jim's solution isn't what I would have done, 'cause it
was what I was playing with last night]

-- 
  Thomas Eibner <http://thomas.eibner.dk/> DnsZone <http://dnszone.org/>
  mod_pointer <http://stderr.net/mod_pointer> <http://photos.eibner.dk/>
  !(C)<http://copywrong.dk/>                  <http://apachegallery.dk/>
          Putting the HEST in .COM <http://www.hestdesign.com/>


--------------------------------------------------
Minneapolis Perl Mongers mailing list

To unsubscribe, send mail to majordomo at pm.org
with "unsubscribe mpls" in the body of the message.



More information about the Mpls-pm mailing list