Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 chanting in the Monastery: (15)
As of 2014-09-23 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (223 votes), past polls