Looks like i didn't read your question well. My original post isn't really a solution to the problem at hand . . .
What you need is a template! You could actually use HTML::Template for this, or roll your own if it is minor enough. I do recommend delimiting your TAG though, maybe enclose USER in brackets [], or just do what tye says. But you will have to substitute your value in.
ORIGINAL POST FOLLOWS:
Oh no! Not the dreaded no strict refs!!
Seriously, do a Super Search on symbolic references and you will see why that are bad, bad, bad.
How about an XML solution instead?
If you have XML::Simple installed, you can run this without a hitch. Next step would be to remove the __DATA__ section and place it in your config file. Then you can worry about $ENV{'USER'}. Good Luck!use strict; use XML::Simple; local $/; my $xml = XMLin(<DATA>, forcearray => 1); foreach (@{$xml->{'user'}}) { print "the user is $_\n"; } __DATA__ <users> <user>jeffa</user> <user>foo</user> <user>bar</user> </users>
jeffa
In reply to (jeffa) Re: Interpolating variables from a file
by jeffa
in thread Interpolating variables from a file
by Rich36
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |