我正在調用perl子例程,並將路徑作爲來自unix CLI模式的參數。 但是獲得Bareword發現錯誤。無論如何要通過這個。無法使用路徑作爲參數從bash調用perl子例程
[[email protected] ~/test]**$perl -e "require qw(./burt.pm) ;file(/u/path,/u/build/);"**
Bareword found where operator expected at -e line 1, near "/u/path"
(Missing operator before path?)
Bareword found where operator expected at -e line 1, near "/u/build"
(Missing operator before build?)
syntax error at -e line 1, near "/u/path"
Execution of -e aborted due to compilation errors.
[[email protected] ~/test]$ cat burt.pm
#!/usr/software/bin/perl5.8.8
use strict;
sub file
{
my ($path1, $path2) = @_;
print "path1 $path1\n";
print "path2 $path2\n";
}
1;
在你的字符串周圍加上引號。 – simbabque
請注意,我嘗試向路徑添加雙引號。無法成功 –
雙引號不會嵌套。使用單引號或q()或qq()。 – choroba