[tpm] dereferencing anonymous hashes
Fulko Hew
fulko.hew at gmail.com
Tue Apr 10 12:25:48 PDT 2007
On 4/10/07, Rob Janes <janes.rob at gmail.com> wrote:
> you're a php guy, right?
Nope. Never seen PHP in my life... ain't gonna start now!
> $x = (); is a list assignment to a scalar. scalar conversion results in
> the scalar ($x that is) being assigned the count of the number of items in
> the list. 0 or zero.
>
> $x = {}; assigns a reference to an anonymous hash.
OK, so I was getting frustrated and made a whole lot of transcription
errors to boot. :-(
The question should have been... whats the difference between:
%x = (); and
%x = {};
because what fixed my problem was (transcribing correctly this time):
my %device = {};
$config{$cfg}{device} = \%device;
$device{$devid}{status} = 'OK';
...
my %device = %{$config{$cfg}{device}};
$status = $device{$devId}{status};
More information about the toronto-pm
mailing list