in reply to Re^2: Question on loops and variables
in thread Question on loops and variables
Are you sure that warnings are enabled in your second script, too? If not, it would explain that you don't get any warnings. I don't see how your second script would change anything.
Note that the original error message even tells you the line number of your data file where the warning is generated with "Use of initialized value ... <F> line 1.". So check the first two lines of your data file (I don't know if the count starts from 0 or 1).
Also assuming the problematic line in the file were an empty line, even $hostname would be an empty string (but not undefined) and all you would see with your prints would be two empty lines in the beginning of the output, so you might have missed the problematic output in your second script. Either use
print "host: $hostname, <$hostip>\n";
or even better use Data::Dumper:
use Data::Dumper; ... print Dumper(\$hostname,\$hostip),"\n";
Data::Dumper may look like overkill for now, but as soon as you start to use more complicated data structures you will find it the best thing since sliced bread
|
|---|