If you have a scalar that has a hash "in it" it would actually be a hash
reference.  If you want to access a single key you can do this:

$hashref->{KeyName}

To access the hash as a hash, you must properly dereference it like so:

%{$hashref}

This is what I think you're looking for. For example now you can do this

foreach (keys (%{$hashref}) )
{
        print "hash{$_} = ", $hashref->{$_},  "\n";
}

if all else fails check the following perl documentation:
perldsc - Perl Data Structures Cookbook
perlreftut - Mark's very short tutorial about references

HTH
-Wayne

> -----Original Message-----
> From: Gordon Stewart [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 14, 2003 9:08 AM
> To: [EMAIL PROTECTED]
> Subject: Array of hashes ?
> 
> 
>   my $results  = $parser->results;
> 
> I'm using the above - as per a good website ive found :-
> 
> http://www.zeegee.com/code/perl/MIME-
> tools/docs/MIME/Parser/Results.pm.html
> 
> and
> 
> http://www.zeegee.com/code/perl/MIME-tools/docs/MIME/Parser.pm.html
> 
> 
> 
> However - When I display it (in the log fles)  it comes up as :-
> 
> 
> CONTENT -
> MIME::Parser::Results=HASH(0x85ffa88)
> MIME::Entity=HASH(0x85ff980)
> 
> 
> I've tried to dso a foreach loop on it - as a hash, & as an array -
> However
> nothing works
> (gives me errors)...
> 
> Can anyone advise how you extract a hash, out of a $variable ?
> 
> G. <Taking long time to do simple task - because help files assume youre a
> mind-reader >
> 
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to