in reply to Pull an array from a hash... or somthing
You seem to be confusing arrays and array references. A reference is actually a scalar that holds an address of something. To get the thing that it addresses, you have to dereference it somehow.
In the data structure you have, this is a reference:
$hash_ref->{devices}->{device}
To get the array, wrap it in @{} like so:
my @array = @{ $hash_ref->{devices}->{device} }
Have a look at perlreftut, and maybe References quick reference,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pull an array from a hash... or somthing
by pez252 (Novice) on Feb 22, 2008 at 19:44 UTC |