读取文件时出现错误,下面是脚本。Perl语法错误:读取文件的示例程序
#!/bin/bash
$file = "SampleLogFile.txt"; #--- line 2
open(MYINPUTFILE,$file); #--- line 3
while(<**MYINPUTFILE**>) {
# Good practice to store $_ value because
# subsequent operations may change it.
my($line) = $_;
# Good practice to always strip the trailing
# newline from the line.
chomp($line);
# Convert the line to upper case.
print "$line" if $line = ~ /sent/;
}
close (MYINPUTFILE);
输出:
PerlTesting_New.ksh [2]:=:找不到
PerlTesting_New.ksh [3]:在3行语法错误:`(”意外
不限知道是什么的问题是什么?
'!#/ usr/bin/env perl'的解释器行对于找到可以在PATH中找到的Perl很有用。 – JRFerguson
我是一个新手,尽管我按照 – crackerplace
更改了相同的错误你是如何调用脚本的? – choroba