Can I replace '<' to '<' and '>' to '>' if it is not a HTML element? I have coded to replace < but not able to add >#!/usr/bin/perl while($line = <DATA>){ @valid_entities= ('<a>','<td>','<th>','<var>','<br>'); my %htmlenties = map { $_ =>1 } @valid_entities; $line =~ s/(<(\w+?)(>))/exists $htmlenties{$1} ? $1 : defined ($2) ? +"<$2$3" : '<'/eg; print $line; } __DATA__ <Hello>Hi...<BR>how r u<br>
In reply to Re^2: close end tag
by Anonymous Monk
in thread close end tag
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |