use strict; use warnings; use Data::Dumper; use YAML; # Load a YAML stream of 3 YAML documents into Perl data structures. my $data = do {local $/ = }; my @yaml = Load( $data ); for my $hash (@yaml) { my $question = $hash->{question}; my $answer = $hash->{answer}; print "q: $question\na: $answer\n"; } __DATA__ --- question: What... is your name? answer:

My name is Sir Lancelot of Camelot.

--- question: What... is your quest? answer:

To seek the Holy Grail.

--- question: What... is your favourite colour? answer:

Blue.