[abcd]Blah, blah, blah?: Yes [efgh]Yadah, yadah?: 1) Foo; 2) Bar; 3) Quux; [ijkl]Blah?: Yes [mnop]Blah, bleh?: Yes, I will. If this and that #### #!/usr/local/bin/perl -w open (DATA, "data.txt") or die "Error"; undef $/; # slurp mode $body=; close DATA; while ( $body =~ /\[(\w+)\]<\/tag1>.*(.*)<\/tag2>/g ) { print "[$1] => [$2]\n"; } #### [abcd] => [yes] [efgh] => [1) Foo; 2) Bar; Quux;] [ijkl] => [Yes] [mnop] => [Yes, I will. If this and that.]