in reply to Newbie question, advice appreciated

Here's a simple example that just writes directly to the output file. The regex could be better, and I'm sure someone will comment and give an alternate.
#!/usr/bin/perl use strict; use warnings; open (FH, '<', 'test.txt') or die "Cannot open 'test.txt' for reading: $!\n"; open (OUT, '>', 'out.html') or die "Cannot open out.html for output: $!\n"; while (<FH>) { if ( /^# STANDARD/ ){ # Grab the current line. my $first_line = $_; # Grab the line right after it. my $second_line = <FH>; print OUT '<p>' . $first_line; print OUT '<p>' . $second_line; } } close FH; close OUT;