in reply to How to retrieve the string after the space???
(untested)my %address; while (<DATA>) { if ( /^(To|From|Contact):.*?(<.*?>)/ ) { $address{$1} = $2; } } for my $field ( qw/To From Contact/ ) { if ( exists( $address{$field} )) { print "The $field address is $address{$field}\n"; } }
|
|---|
| Replies are listed 'Best First'. |
|---|