afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
[personal profile] afuna
Damn. PHP also uses @$. First thing I thought when I saw it was, "Oh neat, it's dereferencing an array reference." Then I realized a) the variable on the LHS wasn't an array, and b) I was in the wrong language.

(It's used for error control instead, which is also neat in its own way, I guess.)

Date: 2008-01-04 03:55 am (UTC)
From: [identity profile] soph.livejournal.com
PHP makes me go :(.

Date: 2008-01-04 11:46 am (UTC)
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)
From: [personal profile] pauamma
At least, PHP doesn't consider @$@ to mean something. :-)

Date: 2008-01-04 02:29 pm (UTC)
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)
From: [personal profile] pauamma
From perldoc perlvar:

       $@      The Perl syntax error message from the last eval() operator.
               If $@ is the null string, the last eval() parsed and executed
               correctly (although the operations you invoked may have failed
               in the normal fashion).  (Mnemonic: Where was the syntax error
               "at"?)


(and @ is the array dereference)

Date: 2008-01-04 02:30 pm (UTC)
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)
From: [personal profile] pauamma
(Yes, you can actually assign an arrayref to $@. I tried.)

Date: 2008-01-06 01:42 am (UTC)
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)
From: [personal profile] pauamma
I have used $@ in code meant to Do Something Useful, but not to store an arrayref in it. You can pass a blessed reference to die inside an eval, which would set $@ to that reference, but blessed references are usually hashrefs (or pseudohash refs a la fields::phash), not arrayrefs.