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

Re: counting backward

by jms53 (Monk)
on Mar 02, 2013 at 14:51 UTC ( #1021422=note: print w/replies, xml ) Need Help??


in reply to counting backward

perl -e 'print "$_ " for (reverse (0..10))'
should work, although not necesarily the most intuitive solution.
J -

Replies are listed 'Best First'.
Re^2: counting backward
by ag4ve (Monk) on Mar 02, 2013 at 15:56 UTC
    Heh, I wasn't even asking about the solutions - more about why an inline reverse operator wasn't part of the implementation (somewhat answered quoting the doc) and why this didn't present a warning.

    That said, I love the conversation and seeing foreach (-$var .. 0) { -$_ } - the memory use of reverse and the simplicity of the solution made me say 'damn'.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021422]
help
Chatterbox?
Discipulus Eatalian is a sponge language..
[Eily]: Discipulus I like chiocciola :D

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2017-11-21 10:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (297 votes). Check out past polls.

    Notices?