in reply to Parse Email Header
Note that when you write:
my $from_address = grep /^From:\s+/i, @{$message->{headers}};
grep is in scalar context, so the return value is the number of matches and not the matches themselves. I think you probably want:
my $from_address = ( grep /^From:\s+/i, @{$message->{headers}} )[0];
which puts it in list context and then returns the value of the first match. However, the return value was 0 so there were no matches anyway. Can you provide the Data::Dumper output for $message->{headers}? I'm not sure what the dump you posted is from but it looks like probably some higher-level object. The regex looks okay so $message->{headers} must not containn what you think it does.
|
|---|
| Replies are listed 'Best First'. |
|---|