$ perl -e '$_ = "hello world"; s/(hello)/uc $1/g; print $_,"\n"' uc hello world $ perl -e '$_ = "hello world"; s/(hello)/uc $1/ge; print' HELLO world