Re: Problem by pushing a String and a Hash on an array!
- From: "Mumia W. (on aioe)" <paduille.4060.mumia.w@xxxxxxxxxxxxx>
- Date: Sun, 31 Dec 2006 00:42:46 -0600
On 12/30/2006 03:46 PM, pod69@xxxxxxx wrote:
Hello,
I try to push on an array(global) a string and a hash ->
push(@array,{name => $n_name, hash => \%myhash});
now i try to read out everything but i have a problems with the array?
I try this to read everything out:
sub println {
for(my $i = 0; $i < scalar(@array) ; $i++ ){
print $array[$i]{name};
my %hash = $array[$i]{hash};
"$Array[$i]{hash}" contains a hash *reference*--not a complete hash. You must de-reference the hash reference before assigning it to a new hash:
my %hash = %{ $array[$i]{hash} };
foreach $key ( keys %hash){
print $key." = ".$hash{$key}."\n"
}
}
}
the name gets printed out but not the hash?
thx
I hope this helps.
--
paduille.4060.mumia.w@xxxxxxxxxxxxx
Windows Vista and your freedom in conflict:
http://www.badvista.org/
.
- References:
- Prev by Date: Re: Disable functionality thru commenting out a use
- Next by Date: FAQ 4.53 How do I manipulate arrays of bits?
- Previous by thread: Re: Problem by pushing a String and a Hash on an array!
- Next by thread: [Announce] ClieOp2psv
- Index(es):
Relevant Pages
|