in reply to indirectly accessing variable

You would do better to put the values in a hash, like this:
my %xml_values = (); $xml_values{year} = '1999'; sub writeBasicTag { my $tag = $_[0]; $writer->startTag($tag); $writer->characters($xml_values{$tag}); $writer->endTag($tag); }
There are all sorts of articles around about why it's a bad idea to access variables by name through other variables.