in reply to Re^3: key value pair or simply a regexp
in thread key value pair or simply a regexp

That's fine, but you should understand the following idiom, because it's much more general and is applicable in this case too.

$_ = <<EOF; msgagt=ESM_WMB_AIX,sec_id=Sec_id,severity=Low,node=test,msgnode=qwmbap +01.xxxxxxxxxxxxx.net,utc=2007-04-26 18:01:59.472+00:00,om=UID=3a7affd +6-f420-11db-80b1-000000000000,AlertCode=AEM001,AlertType=AEM-default, +AppName=AEM-CommonService2,Message=5004:An error has been reported by + the BIPXML4C component.:XML EOF my %hash = map { split /=/, $_, 2 } split /,/; print $hash{'msgagt'}, "\n";

With this, you've loaded the entire string into a hash. You can then access the "variable" you want, e.g. msgagt, by simply looking it up in the hash.