get_xpath returns a list (see the docs), so in your case when you write $bay = $_->get_xpath('bay'), $bay, gets assigned the number of elements in the list, presumably 1.
I believe what you want is $bay= $_->first_child( 'bay');. You can also use $bay = $_->get_xpath('bay', 0), but I believe it is much less clear than simply using first_child.
In reply to Re: XML::Twig oddity
by mirod
in thread XML::Twig oddity
by holli
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |