in reply to Non-destructive substitution?
The usual idiom is:
If you want to combine it with calling a function, use Perls do:($tmp = $string) =~ s/foo/blah/;
Orfunc do {(my $tmp = $string) =~ s/foo/blah; $tmp};
func do {local $_ = $string; s/foo/blah; $_};
-- Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Non-destructive substitution?
by MeowChow (Vicar) on Jul 03, 2001 at 01:27 UTC |