in reply to useless use of a constant in a void context?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Ovid) Re: useless use of a constant in a void context?
by merlyn (Sage) on Nov 20, 2000 at 19:53 UTC | |
|
Re (tilly) 2: useless use of a constant in a void context?
by tilly (Archbishop) on Nov 20, 2000 at 20:20 UTC | |
by merlyn (Sage) on Nov 20, 2000 at 20:37 UTC | |
|
Where is the constant? Where is the void context?
by princepawn (Parson) on Nov 21, 2000 at 19:41 UTC | |
by extremely (Priest) on Nov 22, 2000 at 05:31 UTC | |
by merlyn (Sage) on Nov 21, 2000 at 19:44 UTC |