$ perl -wl my $x = 'X'x10; my $a = 'abc'; substr( $x, 0, length($a), $a ); print $x; abcXXXXXXX