Your program that you posted above does not show any string slurping.

All data read from a file is not reinterpreted. Data read from a file is treated similar to data in single quotes.

Maybe now is a good time to post a program that shows what you are actually doing. If your real problem is with a program that reads data from a file, then please post such a program and a (short, but representative) file to read from. Also, please show the output you get, and the output you expect.

When debugging how Perl sees data, it often helps me to print out the data right after having read it from a file:

my $string= read_file('some_file.txt'); print "Read: [[$string]]\n";

Update: Upon rereading your node, I think your problem is exemplified through your question:

Can you slurp into a single quote string?

Once a string has been read by Perl, be it from the source code or from a file, there is no distinction for Perl between "single quoted" and "double quoted" strings. Strings are plain values.

The only moment where strings get treated differently by Perl is when they are created. Double-quoted strings in source code are subject to variable interpolation and escape character replacement (\n to newline, \t to tab, for example). Single-quoted string are only subject to some very limited escape character replacement (\\ to \, \' to '). Data read from a file is subject to neither. See Quote and Quote-like Operators for further reading.


In reply to Re^3: Extracting money from a double quoted string by Corion
in thread Extracting money from a double quoted string by sherab

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.