http://www.perlmonks.org?node_id=888378


in reply to Handling lines and saving them into variables

If your HTML is not terribly complex, you could use something like YAML

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 $/ = <DATA> }; my @yaml = Load( $data ); for my $hash (@yaml) { my $question = $hash->{question}; my $answer = $hash->{answer}; print "q: $question\na: $answer\n"; } __DATA__ --- question: <b>What... is your name?</b> answer: <p>My name is Sir Lancelot of Camelot.</p> --- question: <b>What... is your quest?</b> answer: <p>To seek the Holy Grail.</p> --- question: <b>What... is your favourite colour?</b> answer: <p>Blue.</p>

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)