Mostly springing from tye's solution, but it avoids the memory growth.
$\ = "\n";
for $n ( 4 .. 6 ){
print for '0' x $n .. '9' x $n;
}
And if you needed different 'digits' then
$\ = "\n";
my @digits = 'a' .. 'j';
for my $n ( 4 .. 6 ) {
print @digits[ split '', $_ ]
for '0' x $n .. '9' x $n;
}
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon