You have a single space before and a single space after both the strings. Is that a required effect? Notice:
my $page="nospaceLOTSnospace space LOTS space"; my $old_text = qq ( LOTS ); my $new_text = qq ( LESS ); $page =~ s/$old_text/$new_text/g; print $page;
... will output ...
nospaceLOTSnospace space LESS space
The first "LOTS" does not get replaced because you are replacing " LOTS " (space before and after) with " LESS "
-- termix
In reply to Re: correct usage of q, quotemeta, with s///
by termix
in thread correct usage of q, quotemeta, with s///
by cidaris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |