in reply to Hashes and Refs
Common problem. "(" denotes a list, "[" creates an anonymous array out of a list, and "{" creates an anonymous hash out of a list. You initialize a hash (%fields) by giving it a list. Doing:
my %fields= { a=>1, b=>2 };
tries to init %fields with a list of one item, that is, tries to set the key to be a hash ref, {a=>1,b=>2}, and provides no value for that key. Just like you don't write:
my @list= [ 0, 1, 2 ];
unless you want an array that contains just one item (and that item is a reference to an anonymous array that contains 3 items).
Does that help?
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (tye)Re: Hashes and Refs
by Chady (Priest) on Mar 08, 2001 at 02:42 UTC |