in reply to iterating over two arrays
You will probably want to load one of the array's values into a hash, keyed on the field you want to correlate them with. It looks like you want to match on username, so that would be your hash key. Here's an abstract example:
my @foo = ( [ 1, 'foo' ], [ 2, 'bar' ], [ 3, 'baz' ], ); my %bar = ( 1 => [ 'a', 'b', 'c' ], 2 => [ 'd', 'e', 'f' ], 3 => [ 'g', 'h', 'i' ], ); for (@foo) { my ($num, $label) = @{ $_ }; print "$label: ", @{ $bar{$num} }, "\n"; }
Here, the number is used to correlate the values.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: iterating over two arrays
by Anonymous Monk on Mar 04, 2005 at 23:05 UTC |