从shell脚本调用perl,如何将返回值从perl传递给shell?

Pro*_*mer 2 perl

我成功地从shell脚本调用了一个perl脚本.现在我想从perl脚本传递一个返回值,指示它是否成功到shell脚本.我该怎么做呢?

谢谢!

szb*_*int 10

只需使用适当的退出值退出Perl脚本即可.

exit $exit_value;

exit 0;

if ($problem) { exit 1 }

在shell脚本中,您将通常$?检查返回值.