in reply to Substituting without modifying
I think that you will be able to meet any two of those three requirements. :)
Here's something to consider, although it requires $foo to be a package variable rather than a lexical, and still involves copying the value:
BTW, there is nothing wrong with your use of my inside the parentheses.$foo = "bar baz"; { (local $foo = $foo) =~ s/bar/quux/; # do something with the modified $foo } # now the original $foo is back again
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Substituting without modifying
by sierrathedog04 (Hermit) on May 20, 2001 at 22:51 UTC |