G'day,
Why am I getting the following two errors from the script fragment below?
Argument "www4.mh.xxxx.co.uk.logstatsto20090610.gz" isn't numeric in division (/) at line 56
Argument "/logs/xxxx/200906/mcs0.telhc/borg2" isn't numeric in division (/) at line 56
The variables $dir and $log are both strings and the concatenation of the two strings, along with the slash in the middle, is also wrapped with quotation marks.
foreach my $dir (@log_dirs) {
foreach my $log (@log_list) {
line 56: if ( -s "$dir/$log" ) {
push(@logs, $dir/$log);
}
}
}
Edit: Line 56 is definitely the if statement. However, Paul, you're right, surrounding the division on line 57 with quotation marks fixes the problem. Thanks.
Edit: The Perl version reporting Line 56 is
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>
Edit: Though using the method of interpolated strings in Perl, given that the variables are themselves strings and I am attempting to join them together with a slash character isn't the net result string concatenation?
cheers,