Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unknown Array

Status
Not open for further replies.

gordonisnz

Programmer
Aug 10, 2003
14
0
0
NZ
Hi there

- Still on the quest for understanding MIME...

I'm using MIME::parser, & in one thing I see :-

my $results = $parser->results;


in the result / log file - I see :-

CONTENT -
MIME::parser::Results=HASH(0x85ffa88)
MIME::Entity=HASH(0x85ff980)


These are two results - Both Hashes :-

Ive tried to do a foreach loop - as a hash, & as an array - neither of them work.

How do you view a Hash, thats been stored in a variable ?

G.
 
They're hash references. Try this:
Code:
#!/usr/bin/perl -w
use strict;
my $foo = { foo => 1, bar => 2 };
print $foo;
You'll get funny numbers doing that too. It's just printing out HASH(memory_location) to tell you it's a reference (this is similar to pointers in C/C++ if you're familiar to them).

You can dereference a reference by placing the symbol for the variable's type in front of it (and, optionally, surrounding the variable name with curly braces) as in:
Code:
%{$foo};   # Hash ref
@{$foo};   # Array ref
&{$foo};   # CODE ref
${$foo};   # Scalar ref
 
kewl

Thanks..

I keep forgetting about this forum...

- Someone mentioned another way too... - which solved the prob...

Ive now got the RECEIVE & SEND attachments going
*EXCEPT* - When its received, it comes as 0 BYTES :-(

I'll do another thread - To hopefully figure this out
- Was working on it last night - But it was nearly bed-time - so doing it tonight...

G

 
$atemp = Data::Dumper->Dump([$results], [qw($results)]);

@temp = split (/debug:/,$atemp);


Ive learnt - to use 'Data Dumper' - To extract the array thingees (whatever theyre called).

& the debug: things - are what im searching for - So its a natural split ;)

G.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top