Re: RFC 132 (v1) subroutines should be able to return an lvalue

[email protected] (Damian Conway) Sat, 19 Aug 2000 05:24:53 +1000 (EST)
Newsgroups perl.perl6.language.subs
Message-ID <[email protected]>
[email protected] (Randal L. Schwartz) writes:

> So is that something we've agreed, that lvalue subs are *always*
> scalars?  That'd mean we can move on to the various implementation
> details. :)

Err, I for one would like to see *any* data types lreturn-able.

If a subroutine can return a list, why not an array or hash?

	my (@names, @ranks, @others);
	sub select_container ($description) {
		switch ($description) {
			case /name/i  { lreturn @names }
			case /rank/i  { lreturn @ranks }
			lreturn @others
		}
	}

	while (<>) {
		push select_container, $_;
	}


Damian