in reply to indirectly accessing variable

You want symbolic references.

$writer->characters($$tag);

But these are a really bad idea for very many reasons. In fact when you "use strict" (and I hope you use strict) symbolic references will trigger a fatal error.

You're better off using a hash.

$writer->characters($vars{$tag});
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re: Re: indirectly accessing variable
by santellij (Novice) on Jul 11, 2003 at 16:12 UTC
    Thanks! I tried the $$tag and got an error. I don't know why I didn't think of a hash -- That did the trick.