If "nothing went wrong but there were no results" is a valid case you need to distinguish then you'd probably be best off returning undef on error and an array reference if successful. Then you could use defined $results to check for error, and check for @{ $results } == 0 to see if there were no matches.
Update: Gah, chopped out the "... is a ... distinguish ..." phrase somehow while editing. Makes a bit more sense now.
In reply to Re: sub returns array or empty array
by Fletch
in thread sub returns array or empty array
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |