Re: Problem by pushing a String and a Hash on an array!
- From: Gunnar Hjalmarsson <noreply@xxxxxxxxx>
- Date: Sat, 30 Dec 2006 23:19:03 +0100
pod69@xxxxxxx wrote:
I try to push on an array(global) a string and a hash ->
push(@array,{name => $n_name, hash => \%myhash});
Do you realize that @array only contains one element, i.e. a hash reference?
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};
foreach $key ( keys %hash){
print $key." = ".$hash{$key}."\n"
}
}
}
the name gets printed out but not the hash?
If that's all you have to tell us, you run the code without strictures and warnings enabled. Please follow the posting guidelines
http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
by adding
use strict;
use warnings;
to the top of your script, and let Perl tell you what's wrong with your code.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.
- References:
- Prev by Date: Re: Assigning pattern matches to an array
- Next by Date: Re: Problem by pushing a String and a Hash on an array!
- Previous by thread: Problem by pushing a String and a Hash on an array!
- Next by thread: Re: Problem by pushing a String and a Hash on an array!
- Index(es):