Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re: one of these codes is not like the other

by runrig (Abbot)
on Jul 17, 2001 at 01:25 UTC ( [id://97183]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: one of these codes is not like the other
in thread one of these codes is not like the other

unless (my $speciesname eq (my specieslist{$entry})) { You don't blindly put my in front of every variable. It is a way to declare variables, so you only put it in front of the first use of a variable (and in a scope where every other use can 'see' it). First, 'specieslist' is a hash, so somewhere you would have 'my %specieslist;' or 'my %specieslist = ....;'. and so speciesname and specieslist in your clause above would not have a my.

And your clause above also has another typo, the lack of a '$' in front of specieslist (but I'm just assuming that's just a typo here from your error message). FYI, you are declaring a new lexical variable '$speciesname' above, which is only scoped (it only exists) in the 'unless' block, and it has an undefined value.

Update: Just noticed this node that might help.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-16 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found