in reply to Re: Replacing characters in a string
in thread Replacing characters in a string
You don't need to go as far as reading the string into an array, but just for fun
I wouldn't exactly call this type of text processing fun, but if you really must, the way you've shown is far more complicated than it needs to be:
my $str = 'nodes0005'; my @chars = split //, $str; @chars[3,4] = ("A", "B"); my $out = join "", @chars;
|
|---|