|
I have a PERL script in which i assign an email address to a string.
I have issues when I include the email-address in double quotes,but it works when I include it between single quotes.
Can anyone explain the behaviour of such a scenario?
|
|
|
In Perl, if you use single quotes the string is taken verbatum. It will not intepret embedded special characters as having special Perl meaning. When you use double quotes special characters will be intepreted as their Perl meaning. For example, '\n' will be \n but "\n" will be new line. In your case, the @ symbol is being intepreted as an array. Here is an example:
'john@aol.com' is inteperted as john@aol.com
"john@aol.com" is interperted as
string = john plus
an array named aol.com
You can use double quotes by putting a \ before the special character. In your case,
"john\@aol.com" = john@aol.com
|
|
|
|
|
|
|
|