Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: (jeffa) Re: permutation understanding

by greywolf (Priest)
on May 25, 2002 at 18:36 UTC ( #169288=note: print w/ replies, xml ) Need Help??


in reply to Re: (jeffa) Re: permutation understanding
in thread permutation understanding

A simple fix:

if (exists $food) { }
Update: Oops, I jumped the gun on that one.

mr greywolf


Comment on Re: Re: (jeffa) Re: permutation understanding
Download Code
Replies are listed 'Best First'.
Re: Re: Re: (jeffa) Re: permutation understanding
by Anonymous Monk on May 25, 2002 at 18:55 UTC
    which version of Perl are you using??? exists may be used on hash or array elements or subroutines, not scalar variables.
Re: Re: Re: (jeffa) Re: permutation understanding
by theguvnor (Chaplain) on May 25, 2002 at 21:36 UTC

    Er, what he means is, you want to test for definedness....

    ..Jon

    Update - you're right Anonymous. Mea culpa. My embarrassed apologies to all. )c:

      Testing with defined would be "infinitely" worse than either the simple true/false test which has a potential off-by-one error or the broken usage of exists. Please test your suggested "fixes".

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (15)
As of 2015-07-30 14:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls