
multi-char pattern with other patterns
I want to do this:
"hello - world" ==> "hello-world"
"hello - world" ==> "hello-world"
"hello - world_good-bye world save ^%^&^&^me" ==>
"hello-world_good-bye_world_save_me"
with one line of code.
here's what I have:
if ($line =~ / /){
$orig=$line;
($mod=$line) =~ s/ /_/g; #space to underscore
$mod =~ s|[^_ -[:alnum:]]||g;
$mod =~ s|_-_|-|g;
print "$orig ==> $mod\n";
}
Quote:
}
that's a mouth full.