in reply to detecting errors when a sub returns undef
Well, lots of ways spring to mind. I prefer to think about such problems in terms of how the caller will have to deal with things. I was going to list several examples but once I hit this one I threw the other ones away:
- tye (but my friends call me "Tye")if( ! check_foo("foo",\$foo) ) ) { warn "No foo present\n"; } else { do_stuff( $foo ); }
|
|---|