Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

RE: Generating a Pattern

by turnstep (Parson)
on Jul 25, 2000 at 05:04 UTC ( #24223=note: print w/ replies, xml ) Need Help??


in reply to Generating a Pattern

Here's how I did it. Have no idea how this does on time.

#!perl $total=10; ## Set to 1000 and watch your memory drain away! :) @a=qw(1); for (1..$total) { print "@a\n"; my @all; $count=1; $x=0; { if ($a[$x] != $a[$x+1]) { push(@all, $count); push(@all, $a[$x]); $count=0; } last unless ++$count and $a[$x++]; redo; } *a=\@all; }


Comment on RE: Generating a Pattern
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-12-25 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (160 votes), past polls