in reply to Re^2: Storing multiple blocks of text in the __DATA__ section
in thread Storing multiple blocks of text in the __DATA__ section
UPDATED to use the minimum necessary look-ahead, so that consecutive "blank lines" inside a record would be handled properly.$/ = ""; while (<DATA>) { s/^(.*)\n//; $key = $1; s/\n==(?=\n)/\n/g; $structure{$key} = $_; } __DATA__ key1 Here's a text block including blank lines ("encoded" as "==" in the pe +rl script): == and here's a part of the block that's enclosed within "blank lines" == and here's the last part of the value for key1. key2 blah blah etc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Storing multiple blocks of text in the __DATA__ section
by blindluke (Hermit) on Jan 03, 2015 at 13:53 UTC |