in reply to Iterating two co-dependant arrays

It looks like you need to either use a hash, or if the keys repeat then use an array of arrays.



for my $arr2(@arr2) {

You are not using the $arr2 variable anywhere so why are you declaring it?    You are iterating over the elements of the array but are using indexing instead so your for loop should look like this instead:

for ( my $j = 0; $j <= $#arr2; $j += 4 ) {


$seen = substr($arr2[$j], 0);

That is the same as saying:

$seen = $arr2[$j];

Replies are listed 'Best First'.
Re^2: Iterating two co-dependant arrays
by Porculus (Hermit) on Jan 08, 2010 at 20:28 UTC
    It looks like you need to either use a hash, or if the keys repeat then use an array of arrays.

    A hash would be better in both cases; if keys repeat then use a hash of arrays. Or a database. Sqlite has excellent performance and is very easy to set up.