geekondemand has asked for the wisdom of the Perl Monks concerning the following question:
I know, however, that eval on strings is relatively slow, so I'm wondering if there's a more efficient way to do this. I really don't need all the power of eval as I'm just trying to interpolate variables, but I haven't been able to do this by other means.my %interpolated = (); foreach (keys %to_interpolate) { $interpolated{$_} = eval "qq/$to_interpolate{$_}/;"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: More Efficient Than Eval
by revdiablo (Prior) on Aug 19, 2005 at 00:48 UTC | |
by dave_the_m (Monsignor) on Aug 19, 2005 at 10:52 UTC | |
|
Re: More Efficient Than Eval
by Roy Johnson (Monsignor) on Aug 19, 2005 at 00:20 UTC | |
|
Re: More Efficient Than Eval
by xdg (Monsignor) on Aug 19, 2005 at 11:24 UTC |