#!/usr/bin/perl -wl
use strict;
my @numberarray = qw(1 120 13);
lengthy(@numberarray);
sub lengthy {
s{
( ^ )
}
{
( "0" x (6-length $_) )
}xe and print for @_;
}
__END__
####
perl -wle ' s/^/("0"x(6-length))/xe and print for @ARGV;' 133 121 10 13
####
perl -wle ' s/^(\d+)/("0"x(6-length).$1)/xe and print or
s/^(\w)/("\x20"x(6-length).$1)/xe and print for @ARGV;' 133 121 10 13 red