在Windows 7中使用ActivePerl,@ ARGV为空 [英] @ARGV is empty using ActivePerl in Windows 7

查看:147
本文介绍了在Windows 7中使用ActivePerl,@ ARGV为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Perl脚本.我正在尝试使用ActivePerl在Windows 7中运行它:

I have the following Perl script. I am trying to run it in Windows 7 using ActivePerl:

#!c:\Perl64\bin\perl.exe -w

use strict;

my $mp3splt_exe = 'c:\Program Files (x86)\mp3splt\mp3splt.exe';

my $mp3splt_args = '-o "@n @f" -g "r%[@o @N]"  -f -t 6.0';

print @ARGV;
my $filename = $ARGV[0];

print "$mp3splt_exe $mp3splt_args $filename\n";

(如您所见,我正在尝试为mp3splt创建包装器:-))

(as you can see, I am trying to create a wrapper for mp3splt :-) )

当我这样运行时:

C:\ Program Files(x86)\ mp3splt> run_mp3splt.pl a

C:\Program Files (x86)\mp3splt>run_mp3splt.pl a

我明白了:

Use of uninitialized value $filename in concatenation (.) or string at C:\Program Files (x86)\mp3splt\run_mp3splt.pl line 12.
c:\Program Files (x86)\mp3splt\mp3splt.exe -o "@n @f" -g "r%[@o @N]"  -f -t 6.0

因此,首先,当我print @ARGV时,什么都不会打印,其次,当我分配$filename = $ARGV[0]时,$filenameundef,所以我得到了警告.

So, first of all, when I print @ARGV, nothing gets printed, and second of all, when I assign $filename = $ARGV[0], $filename is undef, so I get the warning.

那么...我在做什么错?为什么不将命令行参数传递给脚本?

So... what am I doing wrong? Why isn't the commandline parameter being passed to the script?

推荐答案

我很确定Windows 7无法理解shebang行.如果您使用perl run_mp3splt.pl a运行此操作,会发生什么情况?

I'm pretty sure Windows 7 doesn't understand the shebang line. What happens if you run this with perl run_mp3splt.pl a?

这篇关于在Windows 7中使用ActivePerl,@ ARGV为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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