This indeed started from the Abigail .sig as far as I remember--though I don't like sounding like such an old man. Anyhow, time to take out the dusty old factoring program... $\ = " "; for ($_ = '1' x shift; /^(11+?)\1+$/; s/$1/1/g) { print length $1; } print length; This is different from the others in that old thread because this is "purer" and does almost no explicit arithmetic. Now, if "length" is too non-regex for you, here is a function which replaces it: sub base10 { my $digits = ''; local $_ = shift; { s/1111111111/0/g; $digits =~ s{^}{s/1//g||0}e; redo if y/0/1/; } $digits; } Finally, if the s/1//g||0 is too numerical, then you can always just say ('0' .. '9')[s/1//g||0] and it becomes completely stringy... -- Tushar Samant ~ ~ :wq ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe