open my $fh, "source-data.txt" or die "opening source-data.txt: $!"; print "
\n"; while ( my $line = <$fh> ) { # protect against most egregious HTML violations $line =~ s/&/&/g; $line =~ s/</g; $line =~ s/>/>/g; # mark upper-case words as italic. not locale-safe. $line =~ s!\b([A-Z])+\b!$1!g; # output the result print $fh $line; } print $fh "\n"; close $fh or die "closing source-data.txt: $!";