use strict; use warnings; my $line="19476 2013-04-05,12:10:51.909293 host:internal.machine44.company.net main INFO Running normally with ACTION= FAN_A= FAN_B= SEND= FAILURE=<2>"; $line =~ s/\d+ (.*?) /DATE=<$1> /; # to give you the date as well ;) my %info = $line =~ /(\w+)=<(.*?)>/g; print "$_:$info{$_}\n" for keys %info;