Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 studying the Monastery: (7)
As of 2015-07-02 05:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (28 votes), past polls