stroke has asked for the wisdom of the Perl Monks concerning the following question:
Got a simple issue that I can't work out! I'm reading a file line by line, and matching on lines with specific text. Then i want to iterate over that line and match against a list
But ... i'm just grabbing the first line that matches, iterating over that then exiting. I can't figure out how to return to the next file line and repeat the process !
foreach $confLine (<$in>) { if ($confLine =~ /ip4-address address=\"/) { foreach (<DATA>) { my $ip = $_; if ($confLine =~ /ip4-address address=\"$ip/) { $confLine =~ s/\/>/update\"\/>/; } } } print $out $confLine; } ___DATA___ 1.2.3.4 1.2.3.5
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Return to original loop
by choroba (Cardinal) on Oct 15, 2015 at 11:52 UTC | |
by stroke (Acolyte) on Oct 15, 2015 at 14:19 UTC | |
by Athanasius (Archbishop) on Oct 15, 2015 at 15:59 UTC | |
by stroke (Acolyte) on Oct 15, 2015 at 16:07 UTC | |
|
Re: Return to original loop
by AppleFritter (Vicar) on Oct 15, 2015 at 11:49 UTC | |
|
Re: Return to original loop
by NetWallah (Canon) on Oct 15, 2015 at 18:41 UTC |