in reply to Re: hashes with arrays
in thread hashes with arrays
You seem to have an extra level, a hash with a single key.
$ref->{Honda}->[0]="Civic"; $ref->{Honda}->[1]="Accord"; $ref->{Toyota}->[0]="Camry"; $ref->{Toyota}->[1]="Tundra"; $ref->{Toyota}->[2]="Corolla";
By the way, the arrow between indexes can be omitted.
$ref->{Honda}[0]="Civic"; $ref->{Honda}[1]="Accord"; $ref->{Toyota}[0]="Camry"; $ref->{Toyota}[1]="Tundra"; $ref->{Toyota}[2]="Corolla";
It seems odd to refer to array indexes using a constant.
$ref->{Honda} = [ qw( Civic Accord ) ]; $ref->{Toyota} = [ qw( Camry Tundra Corolla ) ];
Or if you were in a loop,
push @{$ref->{Honda}}, 'Civic'; push @{$ref->{Honda}}, 'Accord'; push @{$ref->{Toyota}}, 'Camry'; push @{$ref->{Toyota}}, 'Tundra'; push @{$ref->{Toyota}}, 'Corolla';
|
|---|