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

Re: Re: HElp on program

by repson (Chaplain)
on Mar 25, 2001 at 12:31 UTC ( #66992=note: print w/ replies, xml ) Need Help??

in reply to Re: HElp on program
in thread HElp on program

That code, while it found the main code error, will still sometimes show the error message.

$secretword=$words{$name}; if ($secretword eq ""){ $secretword="stupid"; }

If $name is not found in the hash %words, then $secretword will be undefined and will produce the error mentioned when used as if defined. If you however test for the definedness of $secretword you will be closer to the original aim.

if (defined $secretword) { $secretword = 'stupid'; }

In perl style I'd probably write:

$secretword = $words{$name} || 'stupid';

But that is a matter of choice.

Comment on Re: Re: HElp on program
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2016-05-03 21:09 GMT
Find Nodes?
    Voting Booth?