in reply to Regular Expression Help

Best way is with sprintf:
$u = sprintf "%06d", $u;
If you want to use a substitution, you could do:
$u =~ s/(\d+)/"0"x(6-length($1)).$1/e; if length($u) < 6;
Update: To correct your attempt:
if($u=~/^\d{4}$/){$u=~s/\d\d\d\d/00$u/;} if($u=~/^\d{5}$/){$u=~s/\d\d\d\d\d/0$u/;} # but better written as: # $u = "00$u" if $u =~ /^\d{4}$/; # $u = "00$u" if length($u) == 4; # if you know it's digits