$num = sprintf("%06d", $num); # if only numbers $num = sprintf("%06s", $num); # if num and letters