Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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,

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2016-10-25 11:57 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (317 votes). Check out past polls.