perl -E ' @ary =( "abc", "cbc", "dbd" ); say for map { s/b/FOO/r } @ary; ' aFOOc cFOOc dFOOd