次のPerlスクリプトがあります。ActivePerl を使用して Windows 7 で実行しようとしています。
#!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 のラッパーを作成しようとしています :-) )
次のように実行すると:
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
したがって、まず、 I の場合print @ARGV
は何も出力されず、次に、 as を代入$filename = $ARGV[0]
すると$filename
isundef
になるため、警告が表示されます。
それで...私は何を間違っていますか?コマンドライン パラメータがスクリプトに渡されないのはなぜですか?