in reply to Reference Example

Only when I run this snippet, I get "Not an ARRAY reference at foo.cgi line 7"
$fer is a HASH reference not an ARRAY reference. You want curly brackets '{' not square brackets.

Some more advice: learn how to use Data::Dumper. This will enable you to see inside references and deep structures. The first line you print out will not be very meaningful. Data::Dumper's Dumper function will be far more useful.

Replies are listed 'Best First'.
Re: Re: Reference Example
by agentv (Friar) on May 20, 2002 at 22:43 UTC
    ...this was the most concise statement of the answer I saw here.

    The problem was the form of referenced used in the example. (use square brackets for array elements, curly braces for hash elements.)

    I would also second the suggestion made above that references are something to defer until you are certain that you have a good grasp of the basic data structures. But if you feel that you are ready, it's a very powerful mechanism. (just like pointers are in C programming.)

    ---v