U
usenet
I can do this:
my $foo = "use php";
(my $bar = $foo) =~ s/php/Perl/ig;
print $bar;
## output: 'use Perl'
But I used an intermediate variable ($bar) which I generally dislike.
How could I print the modified version of $foo without changing the
value of $foo and without needing to create an intermediate variable
for this purpose?
my $foo = "use php";
(my $bar = $foo) =~ s/php/Perl/ig;
print $bar;
## output: 'use Perl'
But I used an intermediate variable ($bar) which I generally dislike.
How could I print the modified version of $foo without changing the
value of $foo and without needing to create an intermediate variable
for this purpose?