in reply to how to empty the built_in variable

Like Moron said, parsing XML with regexes is a pita and error prone. The code below uses XML::XPath to do the same job yours does. And besides from being safer it's also more readable (and more perlish :-).

Note: I added a root element to the data so it becomes valid XML.
use strict; use warnings; use XML::XPath; my $xp = XML::XPath->new(ioref => *DATA); #for parsing files: #my $xp = XML::XPath->new(filename => 'test.xml'); print map { $_->string_value, "\n" } grep { $_->string_value } $xp->find('/Root/Table')->get_nodelist; __DATA__ <Root> <Table>First_Table</Table> <Table/> <Table>Second_Table</Table> </Root>
Ouputs:
First_Table Second_Table


holli, /regexed monk/