Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: TIMTOWTDI/golf - counting backwards

by trs80 (Priest)
on Jan 28, 2002 at 21:25 UTC ( [id://142117]=note: print w/replies, xml ) Need Help??


in reply to TIMTOWTDI/golf - counting backwards

Here are my four variations:
$c=ord"\cJ";while($c){print$c--.$/}; $c=ord"\cJ";print$c--.$/for(a..j); for($c=ord"\cJ";$c;$c--){print$c.$/}; $c=ord"\cJ";map{print$c--.$/}(a..j);
UPDATE: I had blindly followed the example and used the \cJ when in fact it was just a \n. Also gmax pointed out that my first example could be shorten by moving the while statement. So here is a revised entry:
$c=ord"\n";print$c--.$/while$c;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found