Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: Small examples of string evalby ikegami (Patriarch) |
on May 13, 2006 at 07:29 UTC ( [id://549196]=note: print w/replies, xml ) | Need Help?? |
In my opinion, eval EXPR (as opposed to eval BLOCK) should be used only as a last resort. Your code is a prime example. It breaks as soon as someone places -, } or \ in %charmap. The following does not, and avoids eval EXPR entirely:
(No, the /e is not the same as eval EXPR. There's no dynamic code generation. /ee, on the other hand, would be the same as eval EXPR.)
In Section
Seekers of Perl Wisdom
|
|