while( <$infh> ) { s{&}{&}g; ## In some case does not match as intended s{&amp;}{&}g; ... }