On Tue, Oct 17, 2000 at 09:21:14AM -0700, Bruce Van Allen wrote: > Both return the item number, so subtract 1 to get the array index. Or > modify the sub to subtract 1 and return a *reference* to the number. > Returning a reference is necessary to avoid a false value if the > value being searched for happens to appear in the first list item, > which would have the index 0; if tested for truth 0 returns false, > whereas a reference to it would return true. Then you have to > dereference the number to use it as the array index. I still prefer returning '0 but true' to avoid this problem, the way some of Perl's builtin functions do, rather than returning a reference. Alternatively, return -1 for not found, the same way index() does, and test for >= 0 to indicate success. Ronald # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org