home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HTML - Publishing on the Internet
/
html_cdrom.iso
/
tools
/
html
/
windows
/
check
/
metachar.pl
< prev
next >
Wrap
Perl Script
|
1995-01-14
|
594b
|
18 lines
#!/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/&/&/g; s/>/>/g; s/</</g;}
print $_;}
##EOF