my $n = 10; my $lastDigits = int rand(10**($n-1)); my $firstDigit = 1+int(rand(9)); my $number = $firstDigit.$lastDigits; print $number;