sub length { my ($self, $uri); my $length = 1; if (ref($_[0])) { $self = shift; $uri = $self->{uri}; } else { $uri = shift; } while ($uri =~ m/((?:\{[^\}]+\})|(?:\[[^\]]+\]))/ig) { if ($1 =~ m/\{([^\}]+)\}/i) { my $temp = $1; $length *= ($temp =~ tr/,/,/); } elsif ($1 =~ m/\[([^\]]+)\]/i) { my ($start, $stop) = sort split('-',$1); $stop = $start+10 unless ($stop); if ($start =~ /\d+/) { #There is one or more digit, so we'll remove anything else that might be there $start =~ s/\D+//g; $stop =~ s/\D+//g; } $length *= $stop - $start + 1; } } return $length; }