Help for this page

Select Code to Download


  1. or download this
    my ($idx_color, $idx_fruit) = (0,1);
    
  2. or download this
    my $hoh =
      {
    ...
        keytwo => { color => 'purple',
                    fruit => 'plum' }
      };
    
  3. or download this
    my ( $color, $fruit ) = @{ $hoh->{ keytwo } }{ qw( color fruit ) };
    
  4. or download this
    my $aoh =
      [
    ...
        { color => 'purple', fruit => 'plum' },
      ];
    my ( $color, $fruit ) = @{ $aoh->[ 1 ] }{ qw( color fruit ) };
    
  5. or download this
    my @fields = qw( color fruit );
    my $aoh;
    
    @{ $aoh->[ @$aoh ] }{ @fields } = @$_ for ( [ qw( green apple ) ],
                                                [ qw( purple plum ) ] );