use strict; use warnings; my $text = "C:\\letters.txt"; my @letters; open(IN, $text) || die "Can't open $text"; @letters = ; close(IN); chomp @letters; foreach my $indiv_note (@letters) { my $letter_text = ($indiv_note =~ /(^\[Sidenote (?: (?!^\[Sidenote). )* )/); print "
$letter_text
\n"; } #### [Sidenote: The same.] _Sunday Evening._ * * * * * I have at this moment got Pickwick and his friends on the Rochester coach, and they are going on swimmingly, in company with a very different character from any I have yet described, who I flatter myself [Sidenote: Miss Hogarth.] FURNIVAL'S INN, _Wednesday Evening, 1835._ MY DEAREST KATE, The House is up; but I am very sorry to say that I must stay at home. I have had a visit from the publishers this morning, and the story cannot