#!/usr/bin/perl use warnings; use strict; use HTML::TokeParser::Simple; my $html; { local $/; $html = } my @stack; my %lookup = ( 'font-weight: bold;' => 'b', 'font-style: italic;' => 'i', 'text-decoration: underline;' => 'u', ); my $tp = HTML::TokeParser::Simple->new(\$html); while (my $t = $tp->get_token){ if ($t->is_start_tag('span')){ my $attr = $t->get_attr('style'); my $tag = $lookup{$attr}; push @stack, $tag; print "<$tag>"; next; } if ($t->is_end_tag('span')){ my $tag = pop @stack; print ""; next; } print $t->as_is; } __DATA__ this is some test text for bolding, underlining and italicizing text.
#### ---------- Capture Output ---------- > "c:\perl\bin\perl.exe" _new.pl this is some test text for bolding, underlining and italicizing text.
> Terminated with exit code 0.