Hi, I have created an array of hashes like so...
All seem fine so far, however, when i try to access the hashes later on with ....
I get....
yet if I do this...
I get ....
So I don't get it , it is hash isn't so why won't the foreach work?
cheers,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts
Code:
# Get user details
my @user = &getSQL("Users","UserID,Role,FullName","1=1","UserID ASC");
foreach my $user (@user)
{
$USERS[0]->{$user->{'UserID'}} = $user->{'FullName'};
$USERS[1]->{$user->{'UserID'}} = $user->{'Role'};
}
All seem fine so far, however, when i try to access the hashes later on with ....
Code:
foreach (@USERS) {
foreach my $key (keys $_){
print "key = $key , value = " . $_->{$key} . "<br>";
}
}
I get....
Type of arg 1 to keys must be hash (not scalar dereference)
yet if I do this...
Code:
print "users[0] = " . $USERS[0];
I get ....
users[0] = HASH(0x2c35044)
So I don't get it , it is hash isn't so why won't the foreach work?
cheers,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts