我有困难理解在Windows中使用Perl的命令参数引用。 使用以下程序:
use strict;
use warnings;
use File::Find;
use File::Copy;
my $dir = shift;
die 'Usage: perl Folderize.pl <directory>' unless $dir;
die "$dir doesn't exist" unless -d $dir;
我根据目录使用单引号或双引号会得到不同的结果。如果我使用 'perl script.pl 'H:\Test!''
调用它,会打印 "'H:\Test!' 不存在"。然而,如果我使用 'perl script.pl "H:\Test!"'
,就可以正常工作。这是为什么呢?
H:\Test
存在吗?而是H:\Test!
不存在? - Quentin