こんばんは
以下のスクリプト フラグメントから次の 2 つのエラーが発生するのはなぜですか?
引数 "www4.mh.xxxx.co.uk.logstatsto20090610.gz" は、56 行目の除算 (/) で数値ではありません
引数 "/logs/xxxx/200906/mcs0.telhc/borg2" は、56 行目の除算 (/) で数値ではありません
変数 $dir と $log はどちらも文字列であり、2 つの文字列の連結は、中間のスラッシュとともに、引用符で囲まれています。
foreach my $dir (@log_dirs) {
foreach my $log (@log_list) {
line 56: if ( -s "$dir/$log" ) {
push(@logs, $dir/$log);
}
}
}
編集: 56 行目は間違いなく if ステートメントです。しかし、Paul さんの言うとおり、57 行目の除算を引用符で囲むと問題が解決します。ありがとう。
編集:行56を報告するPerlバージョンは
stats@fs1:/var/tmp/robertw> /usr/local/perl/bin/perl -v
This is perl, v5.6.1 built for sun4-solaris
Copyright 1987-2001, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
stats@fs1:/var/tmp/robertw>
編集: Perlで補間文字列の方法を使用していますが、変数自体が文字列であり、それらをスラッシュ文字で結合しようとしている場合、最終結果の文字列連結ではありませんか?
乾杯、