![]() |
Use of uninitialized value in string eq
Hi,
I have this script which rotate postfix outgoing IP periodically. This script was running fine with perl version 5.8.0. But having problem which running on a new server which has perl version v5.8.8. The error is: Code:
Use of uninitialized value in string eq at ./test_aol.pl line 7.Code:
#!/usr/bin/perl -w |
Try '==' instead of 'eq'
|
Quote:
Argument "66.165.xx.xx" isn't numeric in numeric eq (==) at ./test_aol.pl line 7. Argument "66.165.xx.xx\n" isn't numeric in numeric eq (==) at ./test_aol.pl line 7. |
Well, I was able to resolve it. Gotta add the following line :)
use warnings; use strict; use threads; my $ip; my $newip; my $host; |
Sorry, I was wrong 'eq' is the right operator -- most likely your file (/scripts/aol_switch.dat) is empty or non-existent.
|
Well, i guess it was too early to be happy. Having trouble :(
Use of uninitialized value in concatenation (.) or string at ./test_aol.pl What else needs to be initiated for the line: print MAIN_CF "smtp_bind_address = ".$newip."\n"; ? |
$newip might not be set if it doesn't match the if or elsif clauses. A standalone print "$newip\n"; will either show blank or error out. (Adding trace statements like this is the first thing I do when hit by puzzling errors.)
Also, you might need to chomp $ip; after reading from the file - one of your error messages shows that it contains a trailing newline. |
Quote:
|
| All times are GMT -5. The time now is 10:45 AM. |