> 
> It was Friday, February 21, 2003 when Dan Muey took the soap 
> box, saying:
> : Hello list,
> : 
> : What is the best way to get the headers of an email into a 
> hash and also the text part of the body into an array or variable?
> 
> Mail::Internet->new() accepts a list reference full of lines 
> in an email message.  This is nice, since getting a list from 
> STDIN is not difficult.
> 
>   my $mail = Mail::Internet->new( [ <STDIN> ] );
>   my $headers = $mail->head->header_hashref;
>   my $subject = $headers->{Subject};

Thanks again Casey here's what I tried ::


#!/usr/bin/perl

use Mail::Internet;
  my $mail = Mail::Internet->new( [ <STDIN> ] );
  my $headers = $mail->head->header_hashref;
  my $subject = $headers->{Subject};
 
print $subject;

OUTPUT 
ARRAY(0x80da1ec)


If I change the my $subject line to :
my @subject = @{${$headers}{'Subject'}}; # or otherwsie do it in list context it works
OUTPUT
mail parse test

I tried doing 
  my ($subject) = $headers->{Subject}; 
And other ways of doing it list context all return
ARRAY(0x80da1ec)

Any ideas??
> 
> Enjoy!
> 
>   Casey West

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to