[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] Parsing rfc822 headers



Hi all

I just came up with this sub that parses a rfc822 header and stuffs it
into a array of hashes (yes - it works).

sub headers {
  return [ map { my $q= {}; @{$q}{'key','value'}= split(/:\s+/, $_, 2);
$q } split(/\n(?!\s)/, $_[0]) ];
}

I can't help but to think the there must be another (shorter/more fun)
way of dooing this. For starters, I'd really like to get rid of $q.

TIA
Borup


==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org