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;