#!/usr/local/bin/perl
#metachar.pl Trivial Perl program to protect HTML/SGML "&<>" meta-characters.
#
# Typical use:
#
#   perl htmlchek.pl infile.text > outfile.htmltext
#
#   This program protects the HTML/SGML metacharacters `&', `<' and `>' by
# replacing them with the appropriate entity references; it is useful for
# importing plain text into an HTML file.
#
eval "exec /usr/local/bin/perl -S $0 $*"
    if $running_under_some_shell; # this emulates #! processing on NIH machines
while (<>) {
    if (/[><&]/) {s/&/&amp;/g; s/>/&gt;/g; s/</&lt;/g;}
    print $_;}
##EOF
