在 Perl 脚本中使用 运行 系统命令时使用通配符

Using wildcard characters while running system command in Perl Script

Perl 脚本中 运行 系统命令时如何使用通配符。 例如,使用 *.src 通过 sed 编辑文件 - 例如:

system("sed -i -e 's/foo/bar/g'  $baseDirPath/*.src");

报错:sed: can't read /home/test/*.src: Not a Directory

这里$baseDirPath被初始化为/home/test

尝试在使用变量 $baseDirPath 之前将其压缩,因为您编写的行应该可以正常工作。