Delete an entry in hash : delete « Hash « Perl






Delete an entry in hash

    


#!/usr/bin/perl -w

use strict;
 
my %where = (
        G     => "Dallas",
        L     => "Exeter",
        I     => "Reading",
        S     => "Oregon"
);

delete $where{L};
print "Lucy lives in $where{L}\n";

   
    
    
    
  








Related examples in the same category

1.Delete the element with key 'Joe' from %hash
2.Delete from hash
3.The delete Function
4.The delete operator removes a key/value pair from an associative array.
5.Check key existance after using 'delete' operator