develooper Front page | perl.fwp | Postings from December 2001

Re: The Santa Claus Golf Apocalypse

Thread Previous | Thread Next
From:
Simon Cozens
Date:
December 3, 2001 06:14
Subject:
Re: The Santa Claus Golf Apocalypse
Message ID:
20011203141616.A16009@netthink.co.uk
On Mon, Dec 03, 2001 at 04:29:19PM +1100, Andrew.Savige@ir.com wrote:
> There is also a bug in the way tsanta.pl computes golf score --
> it ignores newlines in the tally. I admit I did not state
> this originally, but I respectfully ask now that all
> contestants please format their programs on a single line.

There is another interesting hack, which comes about as an implementation
detail of Perl, but I don't know whether or not it qualifies. 

I'm not planning to enter, since I always do embarassingly badly at
these things - I'm afraid I have too much practice writing clear and
readable code that I find it difficult to get into the spirit of things ;-) -
but I guess this would be a pretty useful idiom:

    perl -aln0 -F"\n" -e ...

(Stick an entire file into @F, a line per element.)

However, if you write it as a program, instead of

    #!/usr/bin/perl -aln0 -F"\n"
    ...

you can say
    #!/usr/bin/perl -aln0 -F
    ...

because the character after -F happens to be a newline. Handy, that, eh?

-- 
The most effective debugging tool is still careful thought, coupled with 
judiciously placed print statements. -Kernighan, 1978

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About