Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: TMTOWTDI Puzzle: Generating a range of numbers

by jynx (Priest)
on Dec 19, 2001 at 11:27 UTC ( #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


Comment on Re: TMTOWTDI Puzzle: Generating a range of numbers
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (14)
As of 2014-09-30 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (368 votes), past polls