Do you mean you want to delete the element array[3][1] (whatever its value) or do you want to delete the 5, not knowing where it is in the array (and assuming the array has a particular structure)?
Sign up to request clarification or add additional context in comments.
Comments
-2
Welcome to Stack Overflow!
This one is longer and less efficient but it allows you to select the item to be deleted by value instead of by position (array index). That's useful when you don't know the position.
array.map {|x| x.delete(5) if x.instance_of?(Array); x}
array[3].delete_at(1)?array[3][1](whatever its value) or do you want to delete the5, not knowing where it is in the array (and assuming the array has a particular structure)?