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

Your problem could be because delete does not remove an array element it just sets its value to undef.   To actually remove an array element you need to use splice but you can't do that from inside a loop that is iterating over that array.

Also,  ${$harry{$phash{$k}}}[$bcount] is usually written as  $harry{$phash{$k}}[$bcount].