in reply to How do I insert characters at certain positions in a string?

my $padded = ' ' x 5; substr($padded, 2, 1) = 'A'; substr($padded, 1, 1) = 'B'; now i tried this, and it just changed the Nth (2nd or 3rd) character it did not insert the character

Originally posted as a Categorized Answer.

  • Comment on Re: How do I insert characters at certain positions in a string?