⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eval.t

📁 早期freebsd实现
💻 T
字号:
#!./perl# $RCSfile: eval.t,v $$Revision: 4.0.1.1 $$Date: 91/11/05 18:43:19 $print "1..16\n";eval 'print "ok 1\n";';if ($@ eq '') {print "ok 2\n";} else {print "not ok 2\n";}eval "\$foo\n    = # this is a comment\n'ok 3';";print $foo,"\n";eval "\$foo\n    = # this is a comment\n'ok 4\n';";print $foo;print eval '$foo =';		# this tests for a call through yyerror()if ($@ =~ /line 2/) {print "ok 5\n";} else {print "not ok 5\n";}print eval '$foo = /';	# this tests for a call through fatal()if ($@ =~ /Search/) {print "ok 6\n";} else {print "not ok 6\n";}print eval '"ok 7\n";';# calculate a factorial with recursive evals$foo = 5;$fact = 'if ($foo <= 1) {1;} else {push(@x,$foo--); (eval $fact) * pop(@x);}';$ans = eval $fact;if ($ans == 120) {print "ok 8\n";} else {print "not ok 8\n";}$foo = 5;$fact = 'local($foo)=$foo; $foo <= 1 ? 1 : $foo-- * (eval $fact);';$ans = eval $fact;if ($ans == 120) {print "ok 9\n";} else {print "not ok 9 $ans\n";}open(try,'>Op.eval');print try 'print "ok 10\n"; unlink "Op.eval";',"\n";close try;do 'Op.eval'; print $@;# Test the singlequoted eval optimizer$i = 11;for (1..3) {    eval 'print "ok ", $i++, "\n"';}eval {    print "ok 14\n";    die "ok 16\n";    1;} || print "ok 15\n$@";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -