Good time!

I have problem reading saved data in a file, that is elements of array of strings like this:

'qweqwe', 'rtyr tyr', '\'asdasd', 'fghfg, hfgh'

etc. So, i get it in my script like

@data=do $file;

And here i get the problem: for example, the line from the file

'\'asdasd', 'fghfghfgh'

will be read in the array (two elements) as

asdasd fghfghfgh

instead of

\'asdasd fghfghfgh

that is one element of array misses leading _'_ sign. -- That makes my script unusable (as it uses that element, later, in a regular expression).

So, question is, How i should store my data regarding sign _'_ ?

What i try to achieve, in general, w/ the script is autochanging of text: one string for another (i.e. \'asdasd for fghfghfgh). So, to speed up the chaning process i think now store in the array already precompiled regexps rather than let it be compiled each time i run the script -- hence i would use already ready array rather that divide a string to array each time i run the script.

Thanks for any idea!


In reply to «Do» does not read an array containing element w/ «'» sign. by nikolay

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.