in reply to sub returns array or empty array
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sub returns array or empty array
by jeanluca (Deacon) on Jan 20, 2006 at 14:26 UTC |