milov.nl

Interaction design • webdevelopment • web art • photography

milov.nl : forum : coding : 'perl regular expressions'

perl regular expressions doesnt matter, 051205 01:28
did i do this right? all i want is to replace
"<" with "&lt;"
and
">" with "&gt;"
 
i have
while ($lines = <SOURCEFILE>)
{
$lines =~ tr/ < / &lt; /;
$lines =~ tr/ > / &gt; /;
print($lines);
}
 
MWD5025.rhsl.psu.edu
Re: perl regular expressions doesnt matter, 051205 01:29
i want to do this so i can display html code as text in a browser without the browser trying to format the "html code"
MWD5025.rhsl.psu.edu
Re: perl regular expressions absolut, 051207 01:53
The correct is:
$lines =~ s/\</\&lt\;/igs;
$lines =~ s/\>/\&gt\;/igs;
ppp83-237-45-254.pppoe.mtu-net.ru
Pages: 1