One of the main problems is your regex. You need it to be intepreted as a pattern, since you have multiple items separated by |, yet you can't have the () interpreted because those are regex special characters. So you have to backslash the ().

use strict; use warnings; my $pattern = 'Win2k8_Trace_db|Win2k3_test \(e4ba25c7-5628-45d8-97a7-8 +3331e7ad7e1\)|iserver7 \(035e60d4-3073-4fcc-a78e-6a718b3b502f\)|iserv +er6 \(b93b57e2-ab74-441a-98a7-35dc71feca12\)'; @::FileLines = <DATA>; for (@::FileLines) { chomp; next if !$_ || m/$pattern/; @_ = split /\^/; print "$_[1]\n"; } __DATA__ Memory^Memory^Free MBytes,80124,85490,81912.39,100,Alert,Migrate high +memory consuming VM to another host.^M DvsPortset-0:130066:Win2k3_test (e4ba25c7-5628-45d8-97a7-83331e7ad7e1) +^Network Port^% Outbound Packets Dropped,0.00,0.00,0,0,OK, DvsPortset-0:130066:Win2k3_test (e4ba25c7-5628-45d8-97a7-83331e7ad7e1) +^Network Port^% Received Packets Dropped,0.00,0.00,0,0,OK, _Total)^Physical Cpu^% Processor Time,0.63,13.49,6.27,0,OK, Win2k3_test (e4ba25c7-5628-45d8-97a7-83331e7ad7e1)^Virtual Disk^Comman +ds/sec,0.00,6.72,2,0,OK, iserver6 (b93b57e2-ab74-441a-98a7-35dc71feca12)^Virtual Disk^Writes/se +c,0.00,21.26,1.63,0,OK, iserver7 (035e60d4-3073-4fcc-a78e-6a718b3b502f)^Virtual Disk^Commands/ +sec,0.00,104.15,18.96,0.49,OK, Win2k8_Trace_db^Group Cpu^% Used,0.55,8.88,4.07,0,OK,

In reply to Re: unless condition not working by TJPride
in thread unless condition not working by perlavi

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.