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

Re: Shell Golf



Steven Pritchard wrote:
> On Thu, May 08, 2003 at 11:10:13AM -0500, Danny Sauer wrote:
>>and use "warn" instead of print. :)
> 
> That's not going to quite give the same output either.  :-)

Same output, just on STDERR instead of STDOUT.  Maybe my shell dup()s 
one to the other before executing programs... ;)

Anyway, just so my only contribution isn't exactly the same as someone 
else's:

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

AKA

while(<>){
	@F = split(/./, $_);
	if(@F > $n[0]){
		@n=($x, $ARGV, $_);
	}
}
warn "@n";

--Danny, annoyed at
perl -F. -ane'if(@F>$m){$@=@F.$ARGV.$_;$m=@F};END{warn}' *.pl
for not working due to scoping problems :(




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