in reply to is array the best way to handle this?
I'd use a hash, because you refer to sections of the record by name. Something like the following might work for reading in records, though it's untested.
my @messages; # loop through directory { local ($/, *INPUT); open(INPUT, $dirname . $file) or die; my %record = split(/<(SENDER|TO|FROM|MESSAGE)>/, <INPUT>); push @messages, \%record; }
|
|---|