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" (Score:2)
Good grief (Score:1)
Smells strongly like programming by coincidence, probably due to cargo cult copy-pasting.