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

Re: The Santa Claus Golf Apocalypse

Thread Previous | Thread Next
Simon Cozens
December 3, 2001 06:14
Re: The Santa Claus Golf Apocalypse
Message ID:
On Mon, Dec 03, 2001 at 04:29:19PM +1100, wrote:
> There is also a bug in the way 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About