[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [FWP] Moment of Zen



> From: D@i-works.com [mailto:D@i-works.com]
> Sent: Thursday, September 30, 1999 13:03
> To: fwp@technofile.org
> Subject: [FWP] Moment of Zen
>
> I haven't been able to read the list for a while, but this I have to
> post. Yes, it's somewhat mean-minded, but I had to vent. These are
> snippets taken from a column on the web, slightly altered:
>
>     foreach $site (sort keys %sites) {
>       #...
>       my $mindshare = mindshare(...);
>       $shares{$site} = $mindshare;
>     }
>
> Why sort? Why a temporary variable? And isn't this what makes snooty
> managerial bastards call us "Perl hacks" and deem Perl unsuitable for
> anything?

Why an explicit (slow) loop?

      my %shares;
      @shares{keys %sites} = map mindshare($_) => values %sites;

--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com



==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe