TIMTOWTDI-NAOTAG

stu42j on 2007-08-27T18:49:15

There Is More Than One Way To Do It - Not All Of Them Are Good.

Some legacy code that I am working on, frequently uses this "interesting" idiom for getting the first element of an array.

my @array = some_function();

my $i = 0; foreach my $hash (@array) { $i++; $var = $hash->{somekey}; last; }


I am particularly puzzled by the unused $i.


looks like "leftover cassarole"

merlyn on 2007-08-27T19:13:48

Wow. Simply, wow. And dailywtf.com-worthy. (And yes, I know they changed their name, but that in itself is WTF-worthy.)

Good grief

Aristotle on 2007-09-01T15:04:34

Smells strongly like programming by coincidence, probably due to cargo cult copy-pasting.