Is one of these ways of changing the first character of a string to a capital "X" significantly quicker than the other?
(1) $foo = "X" . substr $foo, 1;
(2) substr $foo, 0, 1 = "X";
(3) $foo =~ s/^./X/;
I think the third is most readable, but is it significantly slower than the other two?
(1) $foo = "X" . substr $foo, 1;
(2) substr $foo, 0, 1 = "X";
(3) $foo =~ s/^./X/;
I think the third is most readable, but is it significantly slower than the other two?