use Config::Simple; $cfg = new Config::Simple(); $cfg->read('c:\work\ftp_config_file.txt'); for ($ct=0, $cfg->param("FTP".$ct.".targetIP")!= '', $ct++) { print " FTP$ct value: ".$cfg->param("FTP$ct.targetIP")."\n"; }
Is displaying the following output:
FTP1 value: 1.1.1.1
FTP1 value: 1.1.1.1
FTP1 value: 1.1.1.1
The c:\work\ftp_config_file.txt contains the following values:
[FTP1] targetIP=1.1.1.1 [FTP2] targetIP=10.10.10.10
For the life of me, I can't see what is causing this to loop three times without incrementing the counter..
I get the correct output when I run the script as such:
use Config::Simple; $cfg = new Config::Simple(); $cfg->read('c:\work\ftp_config_file.txt'); my $ct=1; print " FTP$ct value: ".$cfg->param("FTP$ct.targetIP")."\n"; $ct++; print " FTP$ct value: ".$cfg->param("FTP$ct.targetIP")."\n";
thanks in advance those monks who are most intelligent at deciphering a moron's code. :)
In reply to Need Debug Help by naveed010
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |