in reply to string translation

substr is an lvalue,

my $N = 3; $_ = 'zebra'; # uppercase 1st $N substr($_, 0, $N) = uc substr $_, 0, $N; # lowercase last 3 substr($_, -3) = lc substr $_, -3; print;
That trick can be used with s///, tr///, or any other mutator as well.

After Compline,
Zaxo