in reply to Returning multiple values from subroutine

hmm .. how is the routine supposed to know the required order of return values???

Don't think it's possible without repeating yourself ... I think it's always "Anti-DRY"!

some ideas:

  1. passing names:

    my ($locked_status,$expire)=$ssh->get_user_info($loginid, qw(locked_status expire) );

  2. passing an anonymous hash with references

    $ssh->get_user_info( $loginid, {locked_status=>  \$locked_status, expire=> \$expire} );

  3. returning a hash-ref and slice it

    my ($locked_status,$expire)= @{ $ssh->get_user_info($loginid) }{ qw(locked_status expire) };

  4. returning a list and slice it

    my ($locked_status,$expire)= ( $ssh->get_user_info($loginid) )[$idx_locked_status,$idx_expire];

That's untested and I'm not sure if I got the slicing right, but at least the last example is still compatible with your actual practice. But better use constants for the indices..

Cheers Rolf