else { # If $node is not a reference, then it is just a piece of text # from the HTML file. # print $node, "\n"; open my $out, '>', 'output.html' or die $!; print {$out} "This will be printed to the file.\n"; close $out; } }