in reply to Counting Array in an Array of HoA
Note the above is untested. Also deletes the given array (not the ones in hash). If you want count of how many times, then need to continue to end of array in hash and recreate tester array when it is completely deleted. Also if multiple counting, then the if needs to be done differently.foreach my $key (keys %{$hash}) { my $ar = $hash{$key}; foreach (@{$ar}) { $_ eq $array->[0] && shift @{$array} && !@{$array} && last; } if (!@{$array}) { # was found in the hashes array } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Counting Array in an Array of HoA
by monkfan (Curate) on May 15, 2005 at 10:06 UTC |