APM: creating a hash
Goldilox
Goldilox at teachnet.edb.utexas.edu
Fri Apr 4 18:06:35 CST 2003
Doh!
OK, I'll go hide now.
Rhett
ian at skylist.net writes:
>On 4/4/03 5:49 PM, "Goldilox" <Goldilox at teachnet.edb.utexas.edu> wrote:
>
>> I'm having trouble getting a hash to see everything like I want it too.
>> I need some hash values to have single quotes around them, for example
>> so I try this:
>>
>> %stypes={"'RA'"=>"Rainfall",
>> "'ST'"=>"Stage and Flow"
>> };
>>
>> Error: Reference found where even-sized list expected
>>
>> I've created a reference?
>>
>
>Yes, you've created a reference. The curly brackets make it a hash
>reference, so what you actually want is parentheses, like this:
>
>> %stypes=("'RA'"=>"Rainfall",
>> "'ST'"=>"Stage and Flow"
>> );
>
>It's a common mistake - I've been writing perl for years and still do that
>every now and then. :)
>
>
>_______________________________________________
>Austin mailing list
>Austin at mail.pm.org
>http://mail.pm.org/mailman/listinfo/austin
More information about the Austin
mailing list