in reply to regex renaming
use strict; use warnings; my $text; while ( my $text = <DATA> ) { # match a word that contain 'ou' or # if ( $text =~ m/(ou)|(#)$/ ) { $text =~ s{[/\\]}{-}g; print $text; } } __DATA__ hello.world# world\tour Game.started
That replaces the \ and the / with -. You can add the rest.
UPDATE: added alternate delimiters in response to OP private msg.
|
|---|