Hacker News new | past | comments | ask | show | jobs | submit login

> Choose mnemonic identifiers. If you can't remember what mnemonic means, you've got a problem. - perldoc perlstyle

From that source it should rather be a joke. What is the meaning of `@` again?




> What is the meaning of `@` again?

@rray (just like `$` is for $calar, and `%` is for … uhm …). Everything is mnemonic if you have a sufficient amount of context. :-)


Right. At least, the first two are right:

'@' is a stylized 'a' (for 'array') and '$' is a stylized 's' (for 'scalar').

And '%' is a stylized key-value pair, so used for a Perl hash. IIRC.

Whatever else you may think of Larry Wall, you can't accuse him of not being ingenious :)

>sufficient amount of context.

nice('perl pun') unless not intended;

https://www.google.co.in/search?q=perl+scalar+and+list+conte...

https://perldoc.perl.org/functions/unless.html


> nice('perl pun') unless not intended;

Lovely catch! I wish that it had been intentional.


Heh. Thanks :)


The `@` symbol is a variable by itself, what is very clear from it's name, even more because `$` certainly isn't and I also don't think `%` is one (that last is for dictionaries, by the way).

Another system defined variable is `$_`, that is as well named as the one I cited.

There are many more of those in Perl, but I can't remember them for some reason.


> The `@` symbol is a variable by itself, what is very clear from it's name

I'm almost certain that this is false, at least in Perl 5. (Sigils are dramatically overhauled in Perl 6, and I haven't kept up.)


<plug>

This blog post could be of interest: https://opensource.com/article/18/9/using-sigils-perl-6

</plug>


In "What they have in common is that they consume the Callable role.", shouldn't 'consume' be 'perform' for consistency with your useage elsewhere?


"@" is for an array variable or pulling something in array context. You can have variables declared with $, @, or % depending on whether it is a scalar, array, or hash structure.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: