in reply to Re: Using an array in a hash
in thread Using an array in a hash

The person asked for how to get a array back OUT OF A HASH. None of you have answered the question. I would like to know how to do this as well. Here what I tried and it failed. my @host_type= qw { a b c d e} ; my $j = "small" ; my %vendor_size_hash = ($j => \@host_type ) ; print "\@vendor_size_hash{$j} \n " ;

Replies are listed 'Best First'.
Re^3: Using an array in a hash
by friedo (Prior) on Jan 22, 2005 at 20:11 UTC
    There are two ways to dereference an array, depending on what you need to do. See perlref and perlreftut for the details.

    In short, to dereference an entire array, use:

    my @array = @{ $vendor_size_hash{$j} };
    To dereference a single element in the array, use:
    my $el = $vendor_size_hash{$j}[$number];