Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: TIMTOWTDI/golf - counting backwards

by BrentDax (Hermit)
on Jan 29, 2002 at 03:47 UTC ( [id://142234]=note: print w/replies, xml ) Need Help??


in reply to TIMTOWTDI/golf - counting backwards

Don't laugh--it's my first golf. 55 chars, appears to follow the rules.

$,=$";print sort{$b<=>$a}(ord(b)-ord a)..(ord(k)-ord a)

UPDATE: This occurred to me about five minutes after that one. 45 chars.

$,=$";print sort{$b<=>$a}map{ord()-ord a}b..k

=cut
--Brent Dax
There is no sig.

Replies are listed 'Best First'.
Re: Re: TIMTOWTDI/golf - counting backwards
by blakem (Monsignor) on Jan 29, 2002 at 03:57 UTC
    A quick golf tip....
    sort{$b<=>$a}@arr
    Can be golfed to:
    sort{$b-$a}@arr

    -Blake

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-25 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found