Q:

Replace a string with blanks

I need to replace a certain string with a string blanks that equal removed lines, For instance If I am given
1234567890 

I need to replace some of the text with blanks that equals the number of letters removed.
123    8790

or
1234    90

A:

It really depends on how the "some of the text" is specified.
Suppose you want to replace the string 4567 then you can use a pattern match to find and replace it, like this
use strict;
use warnings;

use Data::Dump;

my $s = '1234567890';

$s =~ s/(4567)/' ' x length $1/e;

or if you know the offset and length of the substring then you can just use substr, like this
substr($s, 3, 4) = ' ' x 4;

which gives the same result.

