in reply to Re: Stripping font "face" values from font tags
in thread Stripping font "face" values from font tags
Nice code. It's even easier with HTML::TokeParser::Simple, though.
use HTML::TokeParser::Simple; my $p = HTML::TokeParser::Simple->new( "foo.html" ) or die "can't open foo.html: $!\n"; while( my $t = $p->get_token ) { if( $t->is_start_tag('font') ) { my $attr = $t->return_attr; delete $attr->{face}; my $attributes = join( " ", map { qq{$_="$attr->{$_}"} } keys +%$attr ); print "<font $attributes>"; } else { print $t->as_is; } }
Cheers,
Ovid
New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)
|
|---|