Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: substitution in a string

by skillet-thief (Friar)
on Sep 28, 2005 at 08:47 UTC ( [id://495665]=note: print w/replies, xml ) Need Help??


in reply to substitution in a string

Two problems with the substitution you tried:

$temp = s|_|.|;

First, you need a tilde: $temp =~ s///

Second, you need the /g operator so that more than just the first "_" is replaced.

 $temp =~ s|_|.|g;
sub sk{ return unless $in = shift; $in =~ s!(.)$!!; print $1; sk($in)} sk("gro.alubaf@yehaf");

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-20 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found