$name =~ s/.replaced//;
Note that the . (dot) in the quoted regex is the metacharacter for the operation "match any character except a newline" and as such will occasionally fail to do what newbie1991 wants. I suggest something like
$name =~ s/\.replaced//;
in which the dot is escaped to remove its meta-magic and make it match only a lowly period.
>perl -wMstrict -le "my $name = 'e.coliXreplaced'; $name =~ s/.replaced//; print qq{'$name'}; " 'e.coli'
In reply to Re^2: Problem with substr
by AnomalousMonk
in thread Problem with substr
by newbie1991
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |