in reply to Grab return values of different type from a sub
Try looking at the Contextual::Return module on CPAN. It allows you to do all of the things you're asking about, and more. Used wisely, it can make your code simpler and easier to maintain.
(Used unwisely, it can make your code a maintenance nightmare of undecipherable confusion. It's a pretty powerful module.)
|
|---|