Adding elements to a hash : Hash Value « Hash « Perl






Adding elements to a hash

    

%hash = ( width => '300', height => '150' );
$hash{ 'color' } = 'blue';
print "\$hash{ 'width' } = $hash{ 'width' }\n";
print "\$hash{ 'height' } = $hash{ 'height' }\n";
print "\$hash{ 'color' } = $hash{ 'color' }\n\n";

   
    
    
    
  








Related examples in the same category

1.Associative arrays are indexed by string values.
2.Building a Price List
3.Using array as the hash value
4.Using the array as the hash value
5.Hash setting and getting
6.Store color value in a hash
7.Accessing Elements