in reply to Re: need help with for loop within an xml
in thread need help with for loop within an xml
for my $n (1..$num){ my $ip = $server->{'CoreLanIP_'.$n.'__1'}; if ($ip eq $br_ip){ my $mask = $server->{'CoreLanNetmask_'.$n};
which did solve one of my problem of searching all the values as per 'corelannum'
As of nowI get the below outputforeach my $n (1..$num){ my $corebrip = $server->{'CoreLanIP_'.$n.'__1'} ; my $brmask = $server->{'CoreLanNetmask_'.$n} ."\n"; if ($corebrip eq $br_ip){ print join ("/", $br_ip, $brmask);
so it is searching the complete xml at once as the data I have posted is only one block...so How can I make the script to search block by block?192.169.73.1/255.255.255.0 192.169.73.1/255.255.255.0 192.169.73.2/255.255.255.0 192.169.73.2/255.255.255.0 192.169.73.3/255.255.255.0 192.169.73.3/255.255.255.0 192.169.73.4/255.255.255.0 192.169.73.4/255.255.255.0 192.169.73.5/255.255.255.0 192.169.73.5/255.255.255.0 192.169.73.6/255.255.255.0 192.169.73.6/255.255.255.0
For each block it should search for all these variables and perform as I say then move to next block as I guess that would simplify things?
like for each block I will have different br_ip, CoreLanIP_'.$n.'__1' and CoreLanNetmask_'.$n
So for each block it should search corelanip and if it matches br_ip then use the equivalent corelannetmask
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: need help with for loop within an xml
by poj (Abbot) on Sep 15, 2015 at 07:43 UTC | |
by deep27ak (Novice) on Sep 15, 2015 at 08:17 UTC | |
by poj (Abbot) on Sep 15, 2015 at 14:50 UTC |