Subject: | strange warnings when reading a file and then start_html |
I have found this really strange bug (?). It happens under a set of some very strange circumstances: you read a file (whose name came from @ARGV) and then use a start_html. As it is very weired I am not sure if its perl or CGI's fault, or even worst some "intended magic feature" that I am missing. See the code below for more details:
#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
# if another array is used instead of @ARGV, it works.
# e.g. @OTHER = @ARGV and loop foreach(@OTHER)
foreach (@ARGV) {
open (INPUT, "< $_") or die "Can't open: $_";
while (<INPUT>) { } # comment out this line and it works
close INPUT;
# this produces some warnings
print start_html;
}
exit 0;
Run this supplying any file name in the command line (it does not seem to matter which kind of file or its contents). Then it produces the following warnings:
Use of uninitialized value in substitution (s///) at (eval 3) line 15.
Use of uninitialized value in substitution (s///) at (eval 3) line 16.
Use of uninitialized value in join or string at (eval 3) line 19.
Use of uninitialized value in join or string at (eval 3) line 22.
I am running in a perl, v5.8.5 built for cygwin-thread-multi-64int.