in reply to grabbing certain lines
Orig regex beefed up slightly.
#!/usr/local/bin/perl -w use strict; use Data::Dumper; my %names_emails = map { /^(?:To|From|Reply-To): (\S+)\s+<?([^\s>]+)/ +} <DATA>; print Dumper( \%names_emails ); __DATA__ To: Bob <test@spam.com> From: lucy test@wherever.c0m Reply-To: somebody somebody@spam.com To: Bob2 <test2@spam.com>
:!./test.pl $VAR1 = { 'somebody' => 'somebody@spam.com', 'lucy' => 'test@wherever.c0m', 'Bob2' => 'test2@spam.com', 'Bob' => 'test@spam.com' };
|
|---|