in reply to Re^2: Nested While loop not working
in thread Nested While loop not working

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

Replies are listed 'Best First'.
Re^4: Nested While loop not working
by Anonymous Monk on Mar 12, 2014 at 09:34 UTC

    Thank you so much Ken :) it did help

Re^4: Nested While loop not working
by Manisha (Initiate) on Mar 12, 2014 at 09:37 UTC

    Thank you so much Ken :) it did help and Sorry for the wrong format of text