Help for this page

Select Code to Download


  1. or download this
         $hash{ 'key1' }{ 'key2' }
    
  2. or download this
         $hash{ 'key1' } = 'foo';
         $hash{ 'key1' }{ 'key2' } = 'bar'; # (2)
    
         # (2) means find %(current pkg)::foo and do
         $(current pkg)::foo{ 'key2' } = 'bar';
    
  3. or download this
         my %hash;
         $hash{ 'key1' } = {}; ## ref to hash
    ...
                      key2 => 'foo'
               }
         );
    
  4. or download this
           $hash{ 'key1' } = 'foo';
           $hash{ 'key1', 'key2' } = 'bar';
    
  5. or download this
    
           my %hash = (
    ...
    
           my $food = $hash{ 'food' };
           print "$food->{ 'color' } $food->{ 'name' }\n";