ooh boy where do i start ...<br>
<br>
sub foo {<br>
my $device = {};
# create an anonymous rash<br>
$config{$cfg}{device} = $device; # And stick it to the major<br>
data structure<br>
<br>
$$device{$devId}{status) = 'ok'; # fill up the anonymous rash<br>
$$device{$devId}{msgCnt}++;<br>
}<br>
<br>
...<br>
<br>
our %device; # use strict or else<br>
{ local *device = $config{$cfg}{device}; # an alias just for me<br>
$status = $device{$devId}{status}; # ahh, here it is<br>
}<br><br>
there you go!<br>
<br><div><span class="gmail_quote">On 4/10/07, <b class="gmail_sendername"><a href="mailto:adam.prime@utoronto.ca">adam.prime@utoronto.ca</a></b> <<a href="mailto:adam.prime@utoronto.ca">adam.prime@utoronto.ca</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Do you really want a reference to a reference to a hash here?<br><br>$config{$cfg}{device} = \$device;
<br><br>That looks like the root of the problem to me. should be:<br><br>$config{$cfg}{device} = $device;<br><br>to work with the rest of your code i'd think, not having tested anything.<br><br>Adam<br><br><br><br><br>
<br>Quoting Fulko Hew <<a href="mailto:fulko.hew@gmail.com">fulko.hew@gmail.com</a>>:<br><br>> I always seem to have a problem dereferencing anonymous hashes...<br>> (a mental block, or I'm just mental!)<br>
><br>> In a subroutine I create the thing as such:<br>><br>> sub foo {<br>>
my $device =
{};
# create an anonymous hash<br>> $config{$cfg}{device} = \$device; # And stick it into the major<br>> data structure<br>><br>> $device{$devId}{status) = 'ok'; # and populate the anonymous hash
<br>> $device{$devId}{msgCnt}++;<br>> }<br>><br>> Then later on I want to extract the status:<br>><br>> my %device = ${$config{$cfg}{device}};<br>> $status = $device{$devId}{status};<br>><br>> but this isn't quite right. ;-(
<br>> _______________________________________________<br>> toronto-pm mailing list<br>> <a href="mailto:toronto-pm@pm.org">toronto-pm@pm.org</a><br>> <a href="http://mail.pm.org/mailman/listinfo/toronto-pm">http://mail.pm.org/mailman/listinfo/toronto-pm
</a><br>><br><br><br><br>_______________________________________________<br>toronto-pm mailing list<br><a href="mailto:toronto-pm@pm.org">toronto-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/toronto-pm">
http://mail.pm.org/mailman/listinfo/toronto-pm</a><br></blockquote></div><br>