* You can replace

    $msg{$2}{del}{$1}{lr} = substr($3, 0, 1);
    $msg{$2}{del}{$1}{to} = $4;
    $msg{$2}{del}{$1}{started} = $time;

with

    $msg{$2}{del}{$1} = { lr      => substr($3, 0, 1),
                          to      => $4,
                          started => $time,
                        };

* You can replace

    $msg{$msgn}{del}{$1}{result} = $2;
    $msg{$msgn}{del}{$1}{report} = $3;
    $msg{$msgn}{del}{$1}{finished} = $time;
 

with 

    my $del = $msg{$msgn}{del}{$1};
    $del->{result} = $2;
    $del->{report} = $3;
    $del->{finished} = $time;

An advanced technique uses a 'hash slice':

    my $del = $msg{$msgn}{del}{$1};
    @{$del}{'result', 'report', 'finished'} = ($2, $3, $time);

This code does the same thing without the $del, but it's hard to read:

    @{$msg{$msgn}{del}{$1}}{'result', 'report', 'finished'} = ($2, $3, $time);

