Firstly, please put your error output in <code>...</code> tags. Does what you've posted there look the same as the error message you received?

When posting, before hitting the [ create ] button, keep editing then hitting the [ preview ] button until your post accurately reflects the information you're attempting to communicate. When updating a post, there's no [ preview ] button; you need to keep editing then hitting the [ update ] button.

The input data you described looks nothing like what you're reading. Did you open the correct file?

The data you've read into $line starts off something like (my best guess at reconstructing it):

144 x Lcb (P CAL_LCBMS [CAL_LCBMS] T lcb I [ACT=-, NCLK=chpl::ec0+clk +, ...

That (along with all the text that follows it) contains many characters that have special meanings within a regex. A character class is specified within square brackets (i.e. [...]). The "[ACT=-," part of $line starts a character class which includes all the charcters in the range "=-,"; however, ord('=') == 61 and ord(',') == 44, so the start of that range is after its end and, therefore, invalid.

That explains the error which would have looked something like:

Invalid [] range "=-," in regex; marked by <-- HERE in m/ 144 x Lcb (P CAL_LCBMS [CAL_LCBMS] T lcb I [ACT=-, <-- HERE ...

While I suspect this is a mistake on your part (e.g. you're reading the wrong file), if you want to interpolate data like that into a regex, you'll need to do something like:

/\Q$line/

See quotemeta for details.

-- Ken


In reply to Re^3: Nested While loop not working by kcott
in thread Nested While loop not working by Manisha

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.