Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: Generate sequential array element combos

by BrowserUk (Patriarch)
on Jul 28, 2004 at 06:22 UTC ( [id://377938]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Generate sequential array element combos
in thread Generate sequential array element combos

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://377938]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-24 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found