Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

(Ovid) Re: TMTOWTDI Puzzle: Generating a range of numbers

by Ovid (Cardinal)
on Dec 19, 2001 at 05:04 UTC ( #132989=note: print w/ replies, xml ) Need Help??

in reply to TMTOWTDI Puzzle: Generating a range of numbers

perl -e "push@_,$_ for reverse q.e...q.n.;for(@_){$_=unpack(q|c|,$_);@ +a=split//;shift@a;$_=join q||,@a};print $_+$l,$/ for reverse@_"

This worked on Win2K 5.6.1, but dies on Cygwin :(

Update: It turns out that it works on Cygwin if the double quotes are changed to single quotes. Also, I noticed that I accidentally snuck a + in there :( Kinda like typing a story without the letter 'e'. This will fix that:

push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split// +; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @ +A


Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Comment on (Ovid) Re: TMTOWTDI Puzzle: Generating a range of numbers
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2015-11-26 12:01 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (697 votes), past polls