perl-embperl mailing list archives

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

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:
For additional commands, e-mail:

View raw message