in reply to Uninitialized value ?
what this does is, if the name $name is not in your list, mexnix currently isn't, it automatically assigns "groucho" to $secretword. || is logical OR and you can find it in your perldoc perlop manpage. With this, you can even skip the if ($secretword eq "") { $secretword = "groucho"} stuff, because it already does it for you. My $0.02#...your code... print "Hello $name,\n "; $secretword = $words{$name} || 'groucho'; #....more code written by you...
__________________________________________________
s mmgfbs nf, nfyojy m,tr yb-zya-zy,s zfzphz,print; - thanks japhy :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Uninitialized value ?
by Hofmator (Curate) on Aug 20, 2001 at 18:08 UTC |