This and other RFCs are available on the web at
http://dev.perl.org/rfc/
=head1 TITLE
Sane resolution to large function returns
=head1 VERSION
Maintainer: Jerrad Pierce <[EMAIL PROTECTED]>
Date: 17 Aug 2000
Version: 1
Mailing List: [EMAIL PROTECTED]
Number: 127
=head1 ABSTRACT
Perl has traditionally returned from various functions long (>3) lists
of values. This can be somewhat frustrating, especially if you require
one of the many datum returned. RFC 37 would have us break backward
compatability to solve this "problem".
=head1 DESCRIPTION
Functions like stat() and get*() return long lists of values.
The implementation is assumedly easy: just push some values
out of C structs into the Perl return stack.
This gives the end user a large list to deal with, which can be
unwieldy, especially when a single datum is desired. The typical
solution is to do something along the lines of C<(stat($file))[8]>.
Not elegant, but it works.
=head1 IMPLEMENTATION
There has been a proposed new core function C<want()>. this seems
to be generally regarded as a good thing. Fine. If it is implemented
we should use it. Offending functions (See RFC 37) should use
C<want()> internally to determine what to return i.e; a list or a hash.
As for single datum access, I<perhaps> C<function->[index]> or
C<function()->{key}> should be considered. This however, is not the
core of this proposal. Merely a possibility. Just as extending the
inelegant metaphor above to C<{function()}->{key}> would become a
possibility.
=head1 REFERENCES
RFC 21: Replace C<wantarray> with a generic C<want> function
RFC 37: Positional Return Lists Considered Harmful