in reply to Accessing (deleting) array elements in a hash of arrays

Some sample data would be helpful in figuring out if you have other problems, but you most certainly should not delete from an array you are looping though with foreach.

Try looping like this instead:

for ($acount = $#{$harry{$k}}; $acount >= 0;--$account) { my $a = $harry{$k}[$acount]; for ($bcount = $#{$harry{$phash{$k}}}; $bcount >= 0; --$bcount) { my $b = $harry{$phash{$k}}[$bcount]; if ($a eq $b) ... splice(@{$harry{$k}}, $acount, 1); splice(@{$harry{$phash{$k}}}, $bcount, 1); ...