#!/usr/local/bin/perl use YAML; use Data::Dumper; my $data = join '', ; my $pages = Load( $data ); # YAML does the syntax checking and parsing. # It is still up to you to perform data validation. print Dumper( $pages ); __DATA__ # this is your data, represented in YAML - page: p1 questions: - name: 4B label: Do you like your pie with ice cream? single: - Yes - No - name: 4C label: Do you like your pie with whipped cream? single: - Yes - No # and so on ... # - page: p2 # questions: # -