|Think about Loose Coupling|
What is the difference between $array and @array?by faq_monk (Initiate)
|on Oct 08, 1999 at 00:20 UTC||Need Help??|
Current Perl documentation can be found at perldoc.perl.org.
Here is our local, out-dated (pre-5.6) version:
The former is a scalar value, the latter an array slice, which makes it a list with one (scalar) value. You should use $ when you want a scalar value (most of the time) and @ when you want a list with one scalar value in it (very, very rarely; nearly never, in fact).
Sometimes it doesn't make a difference, but sometimes it does. For example, compare:
$good = `some program that outputs several lines`;
@bad = `same program that outputs several lines`;
The -w flag will warn you about these matters.