Note the braces around the hash instead of the parens. You get this error when you use parentheses around a list reference instead of square or curly brackets.$spec{V20} = { delete_code => 1, ... ordered => 5 };
The square or curly brackets turn list values into scalar values, while parentheses do not. A parenthesized list, when evaluated in scalar context, throws away the left argument(s). If you had printed your value, you would see that it equals '5', instead of being a hash.
Oddly enough ;), if you picked up Programming Perl, this is explained in the back under
My explanation above is almost verbatim.Useless use of %s in void context.
Cheers,
Ovid
Update: still laughing my head off (ha, ha, thump) at merlyn's response :)
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In reply to (Ovid) Re: useless use of a constant in a void context?
by Ovid
in thread useless use of a constant in a void context?
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |