Regexp on variable

2001-12-13 Thread Rus Foster
Hi All, I've google for this but for the life of me I can't find it. Basic premise is that I have a variable, want to run a regexp over it and then put the results back into itself. So far I have my $foo=bar; $_ = $foo; $foo =~ s/bar/goo/g; There has to be a better way hasn't there? Rus --

Re: Regexp on variable

2001-12-13 Thread Michael R. Wolf
Rus Foster [EMAIL PROTECTED] writes: my $foo=bar; $_ = $foo; $foo =~ s/bar/goo/g; There has to be a better way hasn't there? Define better. You've actually got two metaphores running side by side. Either use a named scalar variable: my $foo=bar; $foo =~ s/bar/goo/g; Or use the