http://www.perlmonks.org?node_id=1040134


in reply to Re^3: Perl 6 <-> Perl 5 bridges (was Re^2: Capturing parenthesis and grouping square brackets)
in thread Capturing parenthesis and grouping square brackets

So what's the difference between $array and @array then?

$ indicates that a variable will behave as if its content were a singular thing. That singular thing could be a number, string, routine, object, etc. -- or an array or hash. In list context its content will evaluate to be a singular thing; if it's actually plural, that singular thing will be a reference to the plural thing.

@ indicates that a variable will behave as if its content were a plural thing. If the content is actually singular it behaves like a 1 element array.

  • Comment on Re^4: Perl 6 <-> Perl 5 bridges (was Re^2: Capturing parenthesis and grouping square brackets)