in reply to winter games, perl, ice and bling

Since you're asking for opinions, instead of just giving a value judgment on your example as a whole I'll point out what I think about specific parts of your code. That way you can see not just the decision but the reasoning.

use strict; # strict is good ++ # Where's warnings? -- sub sum {my $x; $x += $_ for @_; $x } # poorly formatted -- sub avg {sum(@_)/@_} # poorly formatted -- # probably should use scalar @_ instead of just @_ here undef $/; # no need to slurp to do an average for a line -- open(my $F, 'skaters.txt'); # lexical filehandle ++ # please use three-argument open -- # no error check on a system call -- my @x = map{[split/,/]}grep{/\S/}split/\n+/,<$F>; # very poorly formatted -- # uses split to achieve what while ( <$F> ) would have done without th +e above slurp-- # makes me think well of those who call Perl line noise # combines two loops and two searches on one line += 0 # (good display of power, but could have built up # the data structure over time more clearly) for(@x){ @$_ = ($_->[0],avg(@{[sort{$a<=>$b}@{$_}[1..$#$_]]}[1..$#$_-2])) # nearly incomprehensible -- # partly due to unnecessary terseness and formatting -- # partly due to painful twists of syntax -- # (The hash solution on perlbuzz was simpler and clearer.) } @x = sort{$b->[1] <=> $a->[1]}@x; # poor formatting again -- printf "%-5s %-20s %-20s\n",$_+1,@{$x[$_]} for(0..2); # poor formatting again --

I'm sorry if the formatting comments bother you, but part of making a program easy to read and maintain is making it easy to distinguish the syntax tokens.

Another is to use as clear of syntax as you can in the first place. You're using lots of Perl features and smashing them together quite closely. You're doing math against punctuation variables in places where there are clearer ways. You're even assembling punctuation variables from one another ($#$_).

What you have is somewhat clever Perl code, but I wouldn't call it idiomatic, clear, or a preferred practice. Overall, I'd say it looks more like Perl than the Microsoft example cribbed from VB. I don't think it serves the purpose of evangelism through code, though, except maybe as a warning against Perl.

With warnings, some more whitespace, three-argument open, and some adjustments to the syntax in your for loop, it'd be a decent example of TIMTOWTDI. Right now, I'd call it a study in Perl syntax and maybe use it as a code maintenance question on a quiz. I think it's not quite ready to represent Perl as a clean, clear example of a powerful yet approachable tool for quickly developing applications.

If the point was to show simply the power of multiple ways to express the same process, you'd have a winner. Your example is certainly different. Since impressing people with the power and clarity of Perl with a program written in it is the cornerstone of the story with the original examples, I'm afraid I'd have to say your implementation might be counterproductive in that regard.