jay-d has asked for the wisdom of the Perl Monks concerning the following question:

How do I keep my script from seeing the @ $mailaddy='collaborate_logs@ex.sdd.hp.com'; and making it an array?

Replies are listed 'Best First'.
Re: Simple @ Question
by btrott (Parson) on Jun 15, 2000 at 22:13 UTC
    Backslash it in cases of double-quotish interpolation.
    my $mailaddy = "collaborate_logs\@ex.sdd.hp.com";
    The example you gave, though--single quotes--doesn't require backslashes, because the @ is not interpolated. So you shouldn't be having a problem there. You would, however, have a problem in double-quotes and backticks.

    If you're interested in learning more about this, read Mark-Jason Dominus's article What's That Mean?.

      The proxy here is choking, but I'll try that site later. It looks like it's choking later, actually in this sub- sub mailerror { system (" $scriptloc\\blat $scriptloc\\errormsg.txt -t 'jdoscher@nonhp.ex.sdd.hp.com' -s ERROR") ; exit } any ideas?
        Ah, well in this case you'll want to backslash your @, because it *is* within double quotes (the quoted string you're handing to system). So add the backslash, see if that does it.
RE: Simple @ Question
by KM (Priest) on Jun 16, 2000 at 17:44 UTC
    If the @ is double quoted, the @ needs to be escaped. If it is in single quotes, it does not. This is because variables are interpelated in double quotes, and not single.

    my $email = "foo\@bar.com";
    or
    my $email = 'foo@bar.com';

    Cheers,
    KM