|XP is just a number|
Comment onby gods
|on Feb 11, 2000 at 00:06 UTC||Need Help??|
Arrays are a pretty basic concept in Perl and any other language. Someone who needs this tutorial may also need help with concepts like scalar context and when it's implied.
I usually don't like something like this:
$count = @array;
It works, and it's clear, but mostly because of the variable names. Sometimes I've seen something more like:
$stuff = @things;
In that case, I think someone wrote a bug. It's clear what's meant if the scalar context is made explicit like so:
$stuff = scalar @things;
Otherwise, I have to read (perhaps a lot) more code to see how the variable is used and whether that makes sense, given its origin. When the scalar context is explicit, I can tell right away that the programmer really meant what was written.