I am thinking there are no embedded spaces in the field names by the otherwise consistent use of underscore. But lines 12 and 13 of the example output do confuse things. Can you clarify?
This almost works (can't get value of last key):
use strict;
use warnings;
use Data::Dumper;
my $string = 'THREAD_ID:1bf1d698 CDR_TYPE:AO SUB_TIME:240815144127
+ DEL_TIME:240815144127 OA_ADDR:5.0.OTSDC PRE_TRANS_OA:5.0.OTSDC
+ DA_ADDR:1.1.966555696176 PRE_TRANS_DA:1.1.966555696176 ORIG_LOC
+N:10.100.80.7/7220 ORIG_IDNT:OTS A2P DEST_LOCN:173.209.195
+.44/8341 DEST_IDNT:Syniverse A2P I_ERR:0.0 PPS_ID: PPS_PROFIL
+E:AO Submission - OA charged PPS_ERR:1.0 O_ERR:0.0 SILO:
+ MSG_LEN:22 SEG_NUM:1 of 1 DLV_ATT:0 END_POINT:ESME FINA
+L_STATE:DELIVERED REG_DEL:1';
my (@keys) = ($string =~ m/([A-Z_]+):/g);
my $z = qr{(?:[A-Z_]+:|$)};
my %hash = map { $_, ($string =~ m/$_:(.+?)\s*$z/)} @keys;
print Dumper(\%hash);
Output:
$VAR1 = {
'PPS_ID' => ' ',
'THREAD_ID' => '1bf1d698 ',
'DEST_IDNT' => 'Syniverse A2P ',
'CDR_TYPE' => 'AO ',
'ORIG_LOCN' => '10.100.80.7/7220 ',
'REG_DEL' => '1',
'SILO' => ' ',
'DEST_LOCN' => '173.209.195.44/8341 ',
'O_ERR' => '0.0 ',
'OA_ADDR' => '5.0.OTSDC ',
'PRE_TRANS_DA' => '1.1.966555696176 ',
'PPS_PROFILE' => 'AO Submission - OA charged ',
'I_ERR' => '0.0 ',
'DLV_ATT' => '0 ',
'ORIG_IDNT' => 'OTS A2P ',
'DA_ADDR' => '1.1.966555696176 ',
'MSG_LEN' => '22 ',
'FINAL_STATE' => 'DELIVERED ',
'SEG_NUM' => '1 of 1 ',
'SUB_TIME' => '240815144127 ',
'DEL_TIME' => '240815144127 ',
'PPS_ERR' => '1.0 ',
'END_POINT' => 'ESME ',
'PRE_TRANS_OA' => '5.0.OTSDC '
};
Update: with help of MidLifeXis, corrected regex in map to work even for last key:value pair in list. Update 2: changed final \s in map to \s*. Thanks to NetWallah and poj.