in reply to matching values in arrays
If the numbers are negative or non-integral or too big, use a hash %which instead of the array @which.my @which; $which[$_] = "array1" for @array1; $which[$_] = "array2" for @array2; $which[$_] = "array3" for @array3; my @pairs = @array4; while (my ($one,$two) = splice(@pairs,0,2)) { print "$one and $two are in $which[$one] and $which[$two]\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: matching values in arrays
by Excalibor (Pilgrim) on Dec 14, 2004 at 11:25 UTC | |
by Animator (Hermit) on Dec 14, 2004 at 15:46 UTC | |
by Excalibor (Pilgrim) on Dec 14, 2004 at 17:29 UTC | |
by Animator (Hermit) on Dec 14, 2004 at 18:23 UTC | |
by Animator (Hermit) on Dec 14, 2004 at 18:50 UTC |