My goal is to grab certain string of chars from the output of print on line 23,  which would be anything after = and before , Whether I use a regexp or a hash/value pair I don't care, as long as it works! thank you. :)
__DATA__ msgagt=ESM_WMB_AIX,sec_id=Sec _id,severity=Low,node=test,msgnode=qwmbap01.xxxxxxxxxxxxx.net,utc=2007 +-04-26 18:01:59.472+00:00,om=UID=3a7affd6-f420-11db-80b1-000000000000 +,AlertCod e=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004 +:An error has been reported by the BIPXML4C component.:XML __CODE__ 1 use strict; 2 use warnings; 3 #use diagnostics; 4 use Data::Dumper; 5 6 my $ovo = qq(/home/mikej/out); 7 my $msgagt = qr/(?:\w+\=\w+)/; #|(?:\w+=\{.*?\}))/; 8 my ($key,$value); 9 my (%HoA,@HoA); 10 11 open (my $out, "+<", $ovo) or die "file '$ovo' was not opened $!"; 12 13 while (<$out>) { 14 s/^\s+|\s+$//g; ## rid of newlines at begin and end 15 chomp; 16 next unless length $_; ## skip blanks 17 s/^'|'\w+|'.*?$//; ## rid of ticks and ticks plus metachars +\w 18 s/\x7b|\x7d//g; ## rid of { and } 19 ($key,$value) = (split /=/, $_, 0); 20 #print "KEY:\t",$key,"\n"; 21 #print "VALUE:\t",$value,"\n"; 22 #push @{$HoA{$key}}, $value if (/$msgagt/g); 23 print "$_\n" if (/$msgagt/g); 24 } 25 #for my $i (sort keys %HoA) { 26 # print "$i -- @{ $HoA{$i} }\n"; 27 #}
As another idea, what about setting
local $/ = ',';

In reply to key value pair or simply a regexp by mikejones

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.