in reply to Variable being clobbered by a seemingly unrelated while loop
That last for loop is only executing once and it's assigning $runlvl to $_. The matches within the loop are matching on $_, and apparently the call to process is indeed bashing $_. If you change that last loop to
for my $xx ($runlvl) { $xx =~ /2/ and process($0); $xx =~ /3/ and finalize(); }
your problem likewise goes away.
(which surprises me a bit since I thought $_ was always implicitly localized but apparently not, since if we instead put a local $_; declaration in process() the problem likewise disappears.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Variable being clobbered by a seemingly unrelated while loop
by tobyink (Canon) on Oct 08, 2014 at 09:48 UTC | |
by choroba (Cardinal) on Oct 08, 2014 at 11:47 UTC | |
by tobyink (Canon) on Oct 08, 2014 at 12:33 UTC | |
by Anonymous Monk on Oct 08, 2014 at 12:15 UTC | |
by wrog (Friar) on Oct 10, 2014 at 18:29 UTC |