Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Making little array babies

by biosysadmin (Deacon)
on Apr 12, 2004 at 04:54 UTC ( [id://344327]=note: print w/replies, xml ) Need Help??


in reply to Making little array babies

In order to make your program as general as possible, it's a good idea to use an array of arrays. This makes it possible to modify your program with minimal headaches. You can use the modulus operator to determine the array into which each image goes:
my @images = qw( 1 .. 100 ); my @array_of_arrays; my $number_of_arrays = 2; my $count = 0; foreach my $image (@images) { my $index = $count % $number_of_arrays; push @{ $array_of_arrays[ $index ] }, $image; $x++; }
Hope that this helps. Also, as a general hint be sure to use strict. :D

Log In?
Username:
Password:

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

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

    No recent polls found