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

[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?

    $result =~ m#found about (\d+) Web pages#;
    $number = $1;
    $count = ($number =~ m#\d+#) ? $number : 0;

Can you guess the thought process that led to this bizarre code? You
want to test on *success* of match; instead, an untrustworthy $1 is
tested. BTW, $number is used only in these two lines...

Finally:

    print sprintf("<a href=\"$site\">$sites{$site}</a>\n");

You guys have been marvellous. Thank you, thank you all...

--
Tushar Samant
~
~
:wq


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