Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Useless use of private variable in void context

by AnomalousMonk (Archbishop)
on Jun 22, 2010 at 19:17 UTC ( [id://845947]=note: print w/replies, xml ) Need Help??


in reply to Re: Useless use of private variable in void context
in thread Useless use of private variable in void context

But Khen1950fx's code has  $tiu, $min && $tiu < $max as an  if statement condition expression in two places. (I don't understand why this form is used in place of  $tiu => $min && $tiu < $max of the OP code; am I missing something?)

Unless evaluation of  $tiu has some side-effect (e.g., if it was a tied scalar – which it doesn't seem to be: as far as I can see, it's always a humble lexical), its evaluation is still useless and the 'useless use of ...' warning will still be generated.

Replies are listed 'Best First'.
Re^3: Useless use of private variable in void context
by SuicideJunkie (Vicar) on Jun 22, 2010 at 21:17 UTC

    I think the confusion here is that the OP's $tiu => $min && $tiu < $max is equivalent to $tiu, $min && $tiu < $max.

    What was intended, on the other hand is almost certainly $tiu >= $min && $tiu < $max

    Key issue: >= is very different from =>. The former compares numerically. The latter is a fancy way to say comma.

Log In?
Username:
Password:

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

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

    No recent polls found