XP is just a number | |
PerlMonks |
Re: Handling weird return values with or dieby japhy (Canon) |
on Jul 05, 2001 at 16:37 UTC ( [id://94075]=note: print w/replies, xml ) | Need Help?? |
The problem is not with or. The problem is with system(). Unlike functions like open(), unlink(), and chmod(), this does not return a true value on success -- rather, it turns 0 (the shell's version of true) on success, and non-zero on failure. This is documented.
Many people write system(...) == 0 or die to get around this. You can use my Perl 6 module for "fixing" the senses of true and false, found at japhygesis. I'll probably put it on CPAN soon. japhy -- Perl and Regex Hacker
In Section
Seekers of Perl Wisdom
|
|