jzb has asked for the wisdom of the Perl Monks concerning the following question:
However, substitute a variable in for bar:sub changeme{ local $^I = ".$bak"; @ARGV = "somefile"; while (<>) { s/foo/bar/i; print; } }
And nothing happens - it just hangs. Why?sub changeme{ $myvar = somesub(); local $^I = ".$bak"; @ARGV = "somefile"; while (<>) { s/foo/$myvar/i; print; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Edit in place (part2)
by GrandFather (Saint) on May 01, 2006 at 20:43 UTC | |
|
Re: Edit in place (part2)
by ikegami (Patriarch) on May 01, 2006 at 20:40 UTC | |
|
Re: Edit in place (part2)
by CountOrlok (Friar) on May 01, 2006 at 20:40 UTC | |
by ikegami (Patriarch) on May 01, 2006 at 21:24 UTC | |
|
Re: Edit in place (part2)
by davidrw (Prior) on May 01, 2006 at 20:39 UTC | |
by jzb (Hermit) on May 01, 2006 at 20:58 UTC | |
by CountOrlok (Friar) on May 01, 2006 at 21:03 UTC | |
by jzb (Hermit) on May 01, 2006 at 21:13 UTC | |
by GrandFather (Saint) on May 01, 2006 at 21:20 UTC | |
| |
by ikegami (Patriarch) on May 01, 2006 at 21:32 UTC | |
|