in reply to Rebuilding changed tags with HTML::TokeParser

Generally what I'll do for a situation like this is something like:

# Copy the hash for readability # (S|C)ould be updated to reference instead of copy my %attribs = %{$token->[2]}; $tag = '<a'; foreach $name keys (%attribs) { $tag .= " $attrib=$attribs{$name}"; } $tag .= '>';

I find this easier to read than the code you have above, though it's probably not as efficient. I'm sure one of the more experienced Monks will one-up me here but this is what works for me. The above snippet (s|c)ould be updated to reference the hash instead of copying it but I want to be fairly certain the code I give you works.

Update: Ovid has a better solution. See "one of the more experienced Monks..." above.