develooper Front page | perl.golf | Postings from July 2002

Re: more minigolf

Thread Previous | Thread Next
From:
Andrew.Savige
Date:
July 11, 2002 17:57
Subject:
Re: more minigolf
Message ID:
694BB7191495D51183A9005004C0B05452DE70@ir-exchange-srv.ir.com.au
En op 12 juli 2002 sprak FatPhil:
> print"@{[$w=1,map$w*=$_/--$n,-pop..-2]}\n")
> Please - noone feed me any more information - it might trip
> the balance the other way again! :-| 
>
> Truly not of this earth...

Though Ton is not of this earth, the @{[...]} idiom is.
(I think Larry plans to clean it up for Perl 6, however).

I knew about it long before I swung my first club.
I learnt about by reading the Camel (p. 259, "Other Tricks
You Can Do With Hard References", Chapter 8) and from
"Effective Perl Programming", Item 58 "Use @{[...]} or
a tied hash to evaluate expressions inside strings".
Curiously, Joseph N. Hall (who is a keen real golfer)
uses a golf example to explain it on p. 240:
  print "I'm @{[$golfer->name]}\n";  I'm Tiger Woods

Here is another reference to where this trick was used
in a golf game:

http://archive.develooper.com/fwp@perl.org/msg01367.html

/-\ndrew

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