$10K coding deathmatch

Alan Young alansyoungiii at gmail.com
Thu Nov 2 09:47:24 MST 2006


Paul Seamons wrote:
> On Thursday 02 November 2006 8:35 am, Alan Young wrote:
>> perl -ape '$_=((grep{(abs($F[$_]-$F[$_-1])||@F)>=@F}1..$#F)?"not a
>> ":"")."match\n"'
> 
> Wow!  Truly a thing of beauty.
> 
> "-a" - who knew.


*blush* Thanks.

My only problem with this method is that it goes through every single
element of @F, even if the first comparison makes the line not match.
Of course, this would be a simple matter in a more maintainable piece of
code, but I've got to wonder if there isn't a Perl Golfish way to short
circuit the grep and do a next...



More information about the PLUG mailing list