while ( ) { if (/perl/) { s#(\W|\s+)(perl)(\W|\s+)#$1$2$3#i if !//; } print; }