use strict; use warnings; my $text; while ( my $text = ) { # match a word that contain 'ou' or # if ( $text =~ m/(ou)|(#)$/ ) { $text =~ s{[/\\]}{-}g; print $text; } } __DATA__ hello.world# world\tour Game.started