我试图使用 perl 在系统命令提示符下运行一组命令。
这是代码
#!/usr/local/bin/perl -w
use strict;
print_prompt();
sub print_prompt {
print "What's your name?";
system("G:\");
system("cd Documents and Settings/Administrator/eworkspace/Sample");
print `ant`;
}
但这让我跟随错误
Bareword found where operator expected at execute.pl line 11, near "system("cd"
(Might be a runaway multi-line "" string starting on line 10)
String found where operator expected at execute.pl line 11, at end of line
(Missing semicolon on previous line?)
syntax error at execute.pl line 11, near "system("cd Documents "
Can't find string terminator '"' anywhere before EOF at execute.pl line 11.
我该如何解决这个问题?这段代码可能有什么问题?我需要指出空格吗?