Hey monks. Quick question. When in slurp mode, is there anyway to match a newline character other than "\n" ? At the moment I don't need to, but probably will at one point.

Example:
local $/ = undef; my $names = <DATA>; $names =~ /First: (\w+)\nSecond: (\w+)\nThird: (\w+)/; my ( $first, $second, $third ) = ( $1, $2, $3 ); print "$first, $second, $third\n"; __DATA__ First: Bob Second: Me Third: You
The above works, but if I try to replace "\n" in the regex with something else which I would assume would work (namely * or .+) I of course get complaints. Yes, I know that newline characters are special, but if you can't recognize them with a wildcard, isn't slurp mode kinda pointless? The data I'm slurping now is very pretty and well layed out, but what if I was slurping a news article or something?

I'm sure I'm missing something important, so please -- feel free to verbally pound me now.

In reply to slurping (matching \n) by GaijinPunch

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.