in reply to How to get a reference from an eval() string?
Hi exilepanda,
Where are the strings you're putting into eval coming from, are any of them based on user input? If so, you'll have to be very careful to sanitize the user input, otherwise you may be exposed to serious security issues. String eval also has some other disadvantages (syntax errors not detected until runtime, and it's not particularly fast), which is why it's usually discouraged and there are other ways to write the code you're writing. Only if you're sure none of the aforementioned issues are a concern in this case, string eval could be used.
Although it's possible to write some data-walking code without string eval by hand (in which it'd be helpful if you could show some more test cases of what you're trying to to do), maybe in this case the module Data::Diver could be useful to you?
Hope this helps,
-- Hauke D
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to get a reference from an eval() string?
by exilepanda (Friar) on Sep 06, 2016 at 15:49 UTC | |
by haukex (Archbishop) on Sep 07, 2016 at 12:43 UTC |