Although, as LanX already noticed, my descriptions can contain several paragraphs, thank you for suggesting paragraph mode. Your solution is both simple and elegant.

And the technique with encoding line breaks could indeed work. I would switch the two regexps, so there is no need to assign the capture value to $key, and I would use the \\ linebreak symbol, as it is already associated with manual linebreak (in LaTeX).

#!/usr/bin/perl use strict; use warnings; my %desc; { local $/ = ""; while (<DATA>) { s/\\\\/\n/; s/^(.*)\n//; $desc{$1} = $_; } } print "{$_} => \n$desc{$_}" for (keys %desc); __DATA__ house_west You are standing in an open field west of a white house, with a boarded front door. \\ There is a small mailbox here. house_south You are facing the south side of a white house. There is no door here, and all the windows are boarded. house_behind You are behind the white house. A path leads into the forest to the east. \\ In one corner of the house there is a small window which is slightly a +jar.

Again, thank you for your suggestion and the provided examples.

- Luke


In reply to Re^4: Storing multiple blocks of text in the __DATA__ section by blindluke
in thread Storing multiple blocks of text in the __DATA__ section by blindluke

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.