Hi All,

I am reading a file which contains symbols. The task to parse each line in the file to check for line matching (($data =~ m/^\-\w/) || ($data =~ m/^\-/)).

The regex worked for the lines which has no special symbols. When it parse the line which has symbols like

"-M--M-^VM-E=M-[ 4JM-1e+PM-^YM-;M-)M-^KM-u^SSZM-Fr^UnM-oM-`M-^XM-^^M-& +^SGM-HM-L^\^\+~pM-NM-&M-^BM-^@iM-^OM-j9rjM-^[M-2M-RtM-I}M-fT.M--w^ZM- +\E+^WM-wM-I&v^SM-EM-^S8^_E^C^ZM-#M-XM-D"M-EM-"M-^IM-Ef^VM-MhM-$FM-^HM +-b^B>M-^KM-RM-TzM-^BM-mM-[^UM-$M-LM-\HJM-^[^T]H}9af-IhpM-JM-H^LM-iM-9 +TM-^WM-^SM-[^NM-yM-MM-G>M-^OM-b^K|^YM-EE\M-^JM-b+tFM-q5^NM-)M-x&M-^JM +-KM-xVAM-|AM-{[AM-cM-}M-"wM-^HBM-fc_M-DwQtpM-Dn^VM-;YM-lgM-QM-^GM-~(M +-.M-`*M-UM-GM-]M-)M-Na^EM-5M-^K^YM-T^]]x_[M-XM-}M-w,~M- M-^[oM-([xY[M +-DM-wM-BM-(M-$M-oM-r{M-_M-"M-OI^QkM-(sM-MFiU0^^IQM-1`M-Eu%MUC]M-qM-^P +M-^TM-A^VM-f$}+M-GM-"8M-^NN^E^[M-=+M-;}M-PM-2sM-dM- M-^M5M-mM-6IM-^AM +-^K^G^EM-^M^NwUM-^HM-^KM-+M-^U^UlxM-^@M-^YM-KM-}^^M-1M-X~@M-KLM-IM-^N +M-oM-#M-.M-^MwwM-_^[0^G^KFVM-,M-h]9C+M-(MNM-jYM-ZM-mM-pz^^=M-^?M-2#[d +M-TM-m^EM-^C0bM-^[]M-y'YM-i^NAoM-^KM-lM-[2M-^ZeM-9^_M->PM-^RM-C^C^^M- +DM-~^KM-UM-"M-v%M-?!M-CM-jpF^CM-UM-^M^FAM-#M-Wd]M-$ZpM-PM-hYM-1M-%M-l +M-1M-^V~#$M-iWM-^JM-^J^RM-^^^LM-^DJx8M-^H5M-eM-,MM-NM-:M-YYM-^[M-^]M- +^Uf^DM--M-UPM-hM-E?EM-ri@iM-^A^O^QM-RM-6&M-^R^MsP^RM-^M3(IM-TM-xgM"

it is throwing "Modification of a read-only value attempted"

Regex tries to match if a line start with - or - followed by space.

Any idea on this?

Cheers,
Joseph


In reply to Modification of a read-only value attempted by josthi

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.