Consider using an existing data serialization language.
I enjoy using YAML for configuration information or other external data. It's advantages are that it is easy to read and write with any text editor, the syntax is fairly intuitive (it looks a lot like outlines done in email), and there are decent parsers and emitters for many common languages, including Perl (YAML).
Your data in YAML might look like:
my $data = join '', <DATA>;
my $pages = Load( $data );
# YAML does the syntax checking and parsing.
# It is still up to you to perform data validation.
print Dumper( $pages );
# this is your data, represented in YAML
- page: p1
- name: 4B
label: Do you like your pie with ice cream?
- name: 4C
label: Do you like your pie with whipped cream?
# and so on ...
# - page: p2
The Perl data structure looks like this:
$pages = [
'page' => 'p1',
'questions' => [
'name' => '4B',
'label' => 'Do you like your pie with i
'single' => [
'name' => '4C',
'label' => 'Do you like your pie with w
'single' => [
WHITEPAGES.COM | INC
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.