sub pad_zeros { my $optimal_length = 5; my $num = shift; $num =~s/^(\d+)$/("0"x($optimal_length-length$1)).$1/e; return $num; }