Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Problem with substr

by AnomalousMonk (Abbot)
on May 14, 2013 at 19:34 UTC ( #1033538=note: print w/ replies, xml ) Need Help??


in reply to Re: Problem with substr
in thread Problem with substr

$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'


Comment on Re^2: Problem with substr
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033538]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2015-07-08 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls