in reply to key value pair or simply a regexp

It sounds like you just want to change your split() to also split on commas like so:

($key,$value) = split /[=,]/;

Replies are listed 'Best First'.
Re^2: key value pair or simply a regexp
by mikejones (Scribe) on May 18, 2007 at 19:26 UTC
    Close but no cigar. Output is
    KEY: msgagt VALUE: ESM_WMB_AIX KEY: _id VALUE: severity KEY: e VALUE: AEM001 KEY: SM_Integrator.InsertToSYSLOG Use of uninitialized value in print at parse_4_ovo.plx line 22, <$out> + line 7. VALUE: KEY: /DataFlowEngine/ImbRdl/ImbRdlThrowExceptionStatements.cpp: 158 +: SqlThrowExceptionStatement::execute: ComIbmComputeNode: MS_Alert_ES +M_Integrato Use of uninitialized value in print at parse_4_ovo.plx line 22, <$out> + line 9. VALUE: KEY: r#FCMComposite_1_2 Use of uninitialized value in print at parse_4_ovo.plx line 22, <$out> + line 11. VALUE:
    for loop on hash output ########################
    _id -- severity e -- AEM001 msgagt -- ESM_WMB_AIX
    maybe something like this, but even this is not exactly what I need:
    my $data = qq#'msgagt=ESM_WMB_AIX,sec_id=Sec_id,severity=Low,node=test,msgnode=qw +mbap01.cardinalhealth.net,utc={2007-04-26 18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-000000000000,Alert +Code=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message= +5004:An error has been reported by the BIPXML4C component.:XML}' #; print "$_\n" for $data =~ /((?:\w+=\w+)|(?:\w+=\{.*?\}))/g;
    __OUTPUT__
    msgagt=ESM_WMB_AIX sec_id=Sec_id severity=Low node=test msgnode=qwmbap01 UID=3a7affd6 AlertCode=AEM001 AlertType=AEM AppName=AEM Message=5004