crackhed has asked for the wisdom of the Perl Monks concerning the following question:
Here $foo is unchanged, and $qux equals "quux baz". Is there a more elegant way to do this, e.g. without first copying $foo?$foo = "bar baz"; (my $qux = $foo) =~ s/bar/quux/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Substituting without modifying
by chipmunk (Parson) on May 20, 2001 at 21:19 UTC | |
by sierrathedog04 (Hermit) on May 20, 2001 at 22:51 UTC | |
|
Re: Substituting without modifying
by chromatic (Archbishop) on May 21, 2001 at 00:57 UTC | |
|
Re: Substituting without modifying
by lemming (Priest) on May 20, 2001 at 22:30 UTC |