Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://24223]
[shmem]: Lady_Aleena: see perlsub for AUTOLOAD
[Discipulus]: well AUTOLOAD does auto load (if nothing is found you know what to do)
Lady_Aleena goes to read, may take a bit.
[Lady_Aleena]: Um, okay...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2017-06-26 08:54 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (574 votes). Check out past polls.