in reply to regex/perl question about uninitialized value
Isn't '$.' representing text between the <ID> and </ID> tags?
Also, consider using an XML parser from CPAN, such as XML::Twig, instead of a regex.