good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
No, 0 and undef are not always the same. Take 'fork' as an example:
Does a fork(2) system call to create a new process running the same program at the same point. It returns the child pid to the parent process, 0 to the child process, or undef if the fork is unsuccessful.So 0 indicates it is a child process while undef indicates failure. Not the same. In general, you should be checking for definedness if your data is coming from outside of the script anyway. I usually do something like 'if( defined $foo && $foo ne ""){}' That way I avoid warnings about doing a string comparison with an undefined value (or whatever the warning message says). You are using 'strict' and 'warnings', right? Anyway, your code above looks good. Elda Taluta; Sarks Sark; Ark Arks In reply to Re^4: Values passed into a sub routine
by Argel
|
|