in reply to Re: Odd number of elements in anon hash
in thread Odd number of elements in anon hash

Thanks! I guess I'm not so familiar with the basics of "referencing" (I'm not even sure if that's the right name).

so, when you use [ ... ] - does it return a reference to the enclosed an array? I think I was taught to use something like \@{...}. Does it mean the curly should be used only for hashes?

Replies are listed 'Best First'.
Re^3: Odd number of elements in anon hash
by almut (Canon) on Jun 01, 2010 at 13:38 UTC

    [ ... ] returns a reference to an anonymous array.

    { ... } returns a reference to an anonymous hash.  In the appropriate syntactic context like assignment, that is.  Curlies are used for various things, for example a block, or to group/disambiguate when dereferencing, like @{ $obj->method_that_returns_an_arrayref() }.

Re^3: Odd number of elements in anon hash
by GrandFather (Saint) on Jun 01, 2010 at 23:42 UTC