Your test is sound, but the answer is probably that it depends what happens when 'assignment fails'. An array in boolean context (is there such a thing in perl?) will evaluate to true if it contains anything at all:
() is false (undef) is true (0) is true
so if it's coming from a sub that explicitly returns 0 or undef on failure, you'll end up with a populated array. The best thing to do is use just return, since return undef is true in list context. I dimly recall that there occasions when return () is dodgy in scalar context, too, but I can't remember what they are :(
hth
In reply to Re: array test question
by thpfft
in thread array test question
by smackdab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |