perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Ponder" <james.pon...@db.com>
Subject returning lists from subroutines
Date Tue, 09 Jul 2002 13:43:35 GMT
Hi,

I think there may be a bug in your subroutine handling code, or at least an unexpectedness
that I can't find documented:

[$ sub testsub $]
[-
  my @a = ('foo', 'bar');
  return @a;
-]
[$ endsub $]

Whatever context this subroutine is called in, the return statement is always evaluated in
scalar context, so if I called this with:

my @b = testsub();

@b now contains just '2', rather than the two list elements.


Best wishes, James
--
James Ponder



--

This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message