in reply to The safety of string eval and block eval.
eval { print "Every command executed"; warn " must be present here "; die @ARGV; 1 } or die $@;
You can use string eval in a safe way, too, but you must understand exactly what it does, e.g.
my %ops = ( add => '+', subtract => '-', multiply => '*', divide => '/', ); eval "sub $_ { shift() $ops{$_} shift() }" for keys %ops; print add(4, 6);
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
---|