$10K coding deathmatch

Alan Young alansyoungiii at gmail.com
Thu Nov 2 08:24:22 MST 2006


Paul Seamons wrote:
> PS - unmaintainable solution in perl
> perl -ne 'chop;@a=split;$n=grep{$t=abs($a[$_]-$a[$_-1]);!$t||$t>=@a}1..
> $#a;print$n?"not a ":"","match\n"'

I wasn't going to do this but you got me thinking:

perl -ape '$_=((grep{(abs($F[$_]-$F[$_-1])||@F+1)>@F}1..$#F)?"not a
":"")."match\n"'

Am I missing something obvious (or even not so obvious)?



More information about the PLUG mailing list