traveler has asked for the wisdom of the Perl Monks concerning the following question:
Now what I want to have happen is for eval to say, "uh-oh, $foo is not defined. I will look in $data{bar}{values}{foo} to see if it is there." I'm flexible on my data types, but I want the stuff to be evaluated to just use simple variables.$data{bar}{code} = 'print $foo;' ... eval $data{bar}{code};
This is to try to avoid symbolic references. I'm developing code where snippets are found in an XML doc and they refer to tag names so the above might come from
I need it to be as simple as possible to edit the XML so I don't want hash refs there. I want to avoid symbolic refs for the usual reasons. Any suggestions would, of course, be welcome.<data name="foo" value="hello" /> <prog> print $foo; </prog>
Thanks, --traveler
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Supplying a value for an undefined variable
by merlyn (Sage) on Jan 15, 2003 at 23:42 UTC | |
by traveler (Parson) on Jan 16, 2003 at 00:03 UTC | |
|
Re: Supplying a value for an undefined variable
by Coruscate (Sexton) on Jan 15, 2003 at 23:42 UTC |