Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Like others have said, you're better off sticking with "or" except for those few cases where the || is necessary for precedence reasons. Familiarize yourself with the operator precendence chart in the "perlop" manual page, print it out and tape it to your monitor if you have to in the beginning (eventually you'll know it instinctively).
The few cases were I use || instead of "or" are constructions like these: my $var = $cgi->param('foo') || $default{'foo'}; # assign default value if none given my $var = $cgi->param('foo') || ''; # assign empty value if none given (to avoid warnings due to undef value) if ($verbose and $bar || $baz) { print "starting job $job_num\n" } In reply to Re: "or die" versus "|| die"
by perlhaq
|
|