This short perl script
my $var='$array', $val;
$val='val'; eval("push(@{$var},$val)"); print"@{$array}[0]n";
$val='pos'; eval("push(@{$var},$val)"); print"@{$array}[1]n";
$val='fun'; eval("push(@{$var},$val)"); print"@{$array}[2]n";
results to
val
fun
Can anybody explain me, why val
and fun
got pushed on array
, but pos
does not?
I would expect that any value would be pushed by the eval-statement.
Thx.
New contributor
chriro2011 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.