Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Terse Code for Odd Numbers

by tlm (Prior)
on May 14, 2005 at 04:34 UTC ( [id://456980]=note: print w/replies, xml ) Need Help??


in reply to Terse Code for Odd Numbers

Must the keys be printed in numerical order? If not, then this also works:

print keys%{{1..14}};

the lowliest monk

Replies are listed 'Best First'.
Re^2: Terse Code for Odd Numbers
by jrn (Initiate) on May 15, 2005 at 05:26 UTC

    Beautiful. The parent is the first answer that revealed something interesting to me about how perl works. For those who want to try it out, the following would be more usable, but of course less elegant.

    print "$_\n" for sort {$a<=>$b} keys %{{1..14}};

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://456980]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (9)
As of 2024-04-24 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found