Thanks GrandFather. That's what I thought the test was actually doing
So what's a good way to test for truth here?
The reason for the post is that I've written a few subroutines that either return a reference to a complex data structure OR filter entries out of the previously created data structure. The problem I noticed was that if I ended up filtering out all of the entries and returning a reference to the filtered data structure, my test for truth returned unexpected results ( ie: it returned true eventhough the data structure was empty.
3 follow up questions:
1. Should I be returning references from these types of sub-routines?
2. If so, what's the best way to return them?
3. What's a good way to test for truthfulness:
if ( %$ref ) {
...do something
}
or...
if ( %$ref && ref $ref eq 'HASH' ) {
...do something
}
Thanks again for your help.
njcodewarrior