bl0rf said it: don't stringify things that you don't actually need as strings. The "number of digits" needs no stringification, it's a logarithm:
sub number_of_digits {
my $number = shift;
my $base = shift || 10;
1 + int( log($number) / log($base) )
}
--
http://
fruiture.de