Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Unknown problem, throws "Useless use of privt var in void contxt"

by bigmacbear (Monk)
on Jan 21, 2008 at 22:43 UTC ( [id://663457]=note: print w/replies, xml ) Need Help??


in reply to Unknown problem, throws "Useless use of privt var in void contxt"

I'd take a look at the line

if ($month => 10)  {

which actually boils down to

if ("$month", 10)  {

since "=>" is the "fat comma" operator, used in defining hashes, whose only distinction from the comma operator is that it ensures its left-hand argument is a string.

I think you meant to say

if ($month >= 10)  {

instead. Not sure why the error appears so far down, but there you are.

Replies are listed 'Best First'.
Re^2: Unknown problem, throws "Useless use of privt var in void contxt"
by halley (Prior) on Jan 22, 2008 at 14:13 UTC
    Your explanation of => is not entirely accurate.
    if ($month => 10) { ... }
    is equivalent to
    if ($month, 10) { ... }
    The => operator does NOT wrap whatever appears on the left into a string. Instead, it allows any expression, but if a bareword is used, it turns the bareword into a string. Any other expression is left as-is, not even coerced into being a string. (Actually rolling a list into a hash will coerce the keys into strings unless the hash has some magic.)

    --
    [ e d @ h a l l e y . c c ]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://663457]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-19 15:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found