500 iterations of this took 1.15 seconds. 10 iterations running 1..35 took 18.73 seconds. For reference, I'm running this on an Ultrasparc-5.#!/usr/local/bin/perl @a=split(//,"1"); #easier to make test strings this way. :) for (1..10) { print "@a\n"; @b=(); $a=join("",@a); while ( $a =~ /((.)\2*/cg ) { push (@b, (length $1, $2)); } @a=@b }
In reply to RE: Generating a Pattern
by hawson
in thread Generating a Pattern
by japhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |