use strict; use warnings; $_ = join '', ; s///gs; print; __DATA__ text text2 -->text3 #### text text2 -->text3