Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
perl在windows上传递参数_Windows_Perl_Parameters_Quotes - Fatal编程技术网

perl在windows上传递参数

perl在windows上传递参数,windows,perl,parameters,quotes,Windows,Perl,Parameters,Quotes,我有以下代码: $op = shift or die "Usage: rename expr [files]\n"; chomp(@ARGV = <STDIN>) unless @ARGV; print "$op"; for ( @ARGV ) { print "$_"; $was = $_; eval $op; die $@ if $@; rename ( $was, $_ ) unless $was eq $_; } 我得到了正确的结果。我尝试在wind

我有以下代码:

$op = shift or die "Usage: rename expr [files]\n";
chomp(@ARGV = <STDIN>) unless @ARGV;
print "$op";

for ( @ARGV )
{
  print "$_";
  $was = $_;
  eval $op;
  die $@ if $@;
  rename ( $was, $_ ) unless $was eq $_;
 }
我得到了正确的结果。我尝试在windows机器上执行相同的操作,安装了草莓perl,如

  perl massrenamer.pl 's/\.txt/\.txtla/' *.txt


但我没有得到任何结果。有人能帮忙吗?

Wilcard扩展是由shell完成的,但当参数被括在引号中时,windows上的端口perl脚本有一个模块Win32::AutoGlob

快速修复方法:将(@ARGV)替换为(glob“@ARGV”)

$op=shift或die“用法:重命名expr[文件]\n”;
chomp(@ARGV=)除非@ARGV;
打印“$op”;
对于(全局“@ARGV”)
{
打印“$”;
$was=$;
评估$op;
死亡$@如果$@;
重命名($was,$),除非$was为eq$);
}

Wilcard扩展由shell完成,但当参数被括在引号中时,在windows上,端口perl脚本有一个模块Win32::AutoGlob

快速修复方法:将(@ARGV)替换为(glob“@ARGV”)

$op=shift或die“用法:重命名expr[文件]\n”;
chomp(@ARGV=)除非@ARGV;
打印“$op”;
对于(全局“@ARGV”)
{
打印“$”;
$was=$;
评估$op;
死亡$@如果$@;
重命名($was,$),除非$was为eq$);
}
  perl massrenamer.pl 's/\.txt/\.txtla/' *.txt
  perl massrenamer.pl "s/\.txt/\.txtla/" *.txt
  perl massrenamer.pl 's/\.txt/\.txtla/' "*.txt"
$op = shift or die "Usage: rename expr [files]\n";
chomp(@ARGV = <STDIN>) unless @ARGV;
print "$op";

for ( glob "@ARGV" )
{
  print "$_";
  $was = $_;
  eval $op;
  die $@ if $@;
  rename ( $was, $_ ) unless $was eq $_;
}