That should be
perl -e "$var = shift; $var=~s/^(\Q$var\E)$/\u$1/s; print $var;" hi
Text treated as a pattern doesn't (necessarily) match itself.
In reply to Re^2: use shift function in regex
by ikegami
in thread use shift function in regex
by suhailck
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |