use strict; use warnings; use constant LEN => 5; my $n = 12; my $str = '0' x (LEN-length($n)) . $n; print "$str"; #### 00012