如何从另一个传递的参数运行Perl脚本? [英] How to run a perl script from another passing parameters?

查看:285
本文介绍了如何从另一个传递的参数运行Perl脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从另一个传递的参数运行perl脚本?

我正在尝试使用在我找不到的互联网帖子中找到的解决方案.
就像这样:

I'm trying to use a solution found in a internet post that i can't find anymore.
It was something like:

do 'script.cgi param1 param2';

在另一个脚本中,我只是简单地使用shift来获取这些参数:

And in the other script I'm using simply the shift to get those parameters:

#Parameters
my $param1= shift;
my $param2= shift;

我看到人们使用带有args的系统,但是对真实情况更好吗?
如果没有,如何使用"do EXPR"解决方案?
预先感谢.

I saw people using system with args, but is it better for real?
If not, how can I fix the solution with 'do EXPR'?
Thanks in advance.

推荐答案

哦,我解决了:

{local @ARGV = (@my_args); do $script;}

有效.如果有人有更好的建议,请随时告诉我.
同时,我正在使用此解决方案.

It works. If anybody has any better suggestions feel free to tell them to me.
Meantime i'm using this solution.

这篇关于如何从另一个传递的参数运行Perl脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆