Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Having a problem replacing "@" with "\@"

by Tanktalus (Canon)
on Apr 19, 2005 at 19:00 UTC ( [id://449399]=note: print w/replies, xml ) Need Help??


in reply to Having a problem replacing "@" with "\@"

I'm really actually quite interested in why you need to do this. Generally speaking, when you load a string from a file, the perl interpreter doesn't get involved, so you end up with a literal @ in the string, and there's no need to escape it.

That's not to say that this isn't a valid requirement, only that, without information to the contrary, the likelihood of a real desire to escape this character is really quite low. Not zero, but still quite low.

  • Comment on Re: Having a problem replacing "@" with "\@"

Replies are listed 'Best First'.
Re^2: Having a problem replacing "@" with "\@"
by chas (Priest) on Apr 19, 2005 at 20:29 UTC
    If you are sending mail with a script, and have something like print(MAIL "To: someone\@somewhere.someorg\n"); the @ needs to be escaped. Of course, one could use single quotes here (except for the newline), but one might want to store the address in a variable and have that and some other things interpolated, and then the @ may cause problems if it's not escaped. It is often possible to get around that with some cleverness, but sometimes it's easier to just escape the troublesome characters.
    (At least, that's what I imagine the OP might be dealing with.)
    (Update: After thinking about it for a while, I can't really think of a convincing reason to escape the @. My brain is just not working well today...please ignore me! I'll shut up for the rest of the day.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-24 04:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found