Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: TMTOWTDI Puzzle: Generating a range of numbers

by jynx (Priest)
on Dec 19, 2001 at 11:27 UTC ( [id://133042]=note: print w/replies, xml ) Need Help??


in reply to TMTOWTDI Puzzle: Generating a range of numbers


How about a mysterious tack?

The first is my favorite, and doesn't remotely work under warnings or strict. The second is a recusive solution for fun. The third is the trivialization of both solutions.

#1 $$_=~/((((((((((.))))))))))/for length$"..length$"x($^F<<$^F).$"x$^ +F; print map$_.$",sort{chr($a)cmp chr($b)}grep!($|eq$_)&&/\d/,keys%:: #2 sub r{ ($_,$a)=@_;$;=join'',/(.)/,$_;print$",length;r($;,$a)if!(length$; +eq$a) } r$",length$"x($^F<<$^F).$"x$^F.$" #3 print $_ for length$"..length$"x($^F<<$^F).$"x$^F
Thanx for the fun,
jynx

update: d'oh, atcroft beat me to recursion...
update2: reformatted, hopefully it looks better

Log In?
Username:
Password:

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

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

    No recent polls found