It looks like you are also new to Perl ;--)
The arguments to a sub are passed in the @_ array, not in $_.
So your sub should start with
as it is, the content of $_ is still set by XML::Twig to the element that triggered the handler.
Did you try:
? There is no need for a method call on the attribute, att already returns its value. To set an attribute, use set_att
Have you seen the Quick ref card? xmltwig.org/xmltwig/quick_ref.html