Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: TMTOWTDI Puzzle: Generating a range of numbers

by atcroft (Monsignor)
on Dec 19, 2001 at 10:58 UTC ( #133036=note: print w/ replies, xml ) Need Help??


in reply to TMTOWTDI Puzzle: Generating a range of numbers

My first attempt at one of the puzzles on here (I think someone had a suggestion similar to this). Thought it might be appropriate, though.

#!/usr/bin/perl -- -l -w my $msg = "happy b-day perl"; $msg =~ s/\s*|perl//g; &gen($msg); sub gen { my ($st) = @_; if (length($st)) { my @temp = split('', $st); shift(@temp); &gen(join('', @temp)); print(length($st), ' '); } }


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://133036]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-12-20 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls