Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error trying to substitute a @ with a \@ in a string 1

Status
Not open for further replies.

jcarrott

Programmer
May 28, 2009
130
US
I am trying to change the @ sign in the string to a \@ so that I can use the string as part of a mail command.

Code:
            $vSendTo = "myname@ochsner.org";        # over-ride $vSendTo
            $vSendTo =~ s/@/\\@\;

            print "\t$vSendTo\n";

The error I get is

Code:
$ perl reqNoteTest_sh
Substitution replacement not terminated at reqNoteTest_sh line 2.

Can somebody tell me how to format the special characters?
 
I tried

Code:
            $vSendTo = "myname@ochsner.org";
            $vSendTo =~ s:\@:\\@:;

            print "\t$vSendTo\n";

and the result was

Code:
$ perl reqNoteTest_sh
        myname.org

I was hoping that switching to : rather than the backlash would help. It did not.

Can somebody help me?
 
Try this:

Code:
$vSendTo = 'myname@ochsner.org';

This may solve your problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top