Delete() in Perl is used to delete the specified keys and their associated values from a hash, or the specified elements in the case of an array. This operation works only on individual elements or slices.
LIST which is to be deleted
undef if the key does not exist otherwise it returns the value associated with the deleted key
Example 1: Implementing delete() on a Hash
45 40 Deleted element: 30
Example 2: Implementing delete() on an Array
Updated Array: 10 20 40 50 60 Deleted element: 30
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.