[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell Golf



>> perl -F. -ane'$x=@F;@n=($x,$ARGV,$_)if@F>$n[0];END{warn"@n"}' *.pl
>
> Since you guys are quibbling over whitespace, here's my own entry
> that whacks 4 more characters off of Steve's bloated entry:
>
> perl -F. -ane'@n=(++$#F,$ARGV,$_)if$#F>$n[0];END{warn"@n"}' *.pl
>
> Rock on. 64 characters.
>
> Mike808/

Oh, yeah - adding to the array count will keep it in scalar context...  So:

perl -F. -ane'@n=(0+@F,$ARGV,$_)if@F>$n[0];END{warn"@n"}' *.pl

62 chars. ;)

--Danny, who had to look up "$#" - that's just Evil, Mike...




-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.