[comp.lang.perl] Patch level 12: explicit return bug/feature

metz@iam.unibe.ch (Igor Metz) (03/04/90)

We upgraded from pl 8 to pl 12 and suddenly one of our favorite perl scripts
didn't run anymore. I found out, that Patch Level 8 allowed the following
syntax for the explicit return of an array:

   return (@files);

In patch level 12 this syntax is still allowed, but this doesn't return the
array, but its length...

The program below gives the following output:

3
A B C

################################################
@val = &foo1();
print "@val \n";
@val = &foo2();
print "@val \n";

exit 0;

sub foo1 {
  local(@files);

  @files = ("A", "B", "C");
  return (@files);
}

sub foo2 {
  local(@files);

  @files = ("A", "B", "C");
  return @files;
}
################################################################

Igor Metz                    X400: metz@iamsm.iam.unibe.ch
Institut fuer Informatik     ARPA: metz%iamsm.iam.unibe.ch@relay.cs.net
und angewandte Mathematik    UUCP: ..!uunet!mcsun!iamsm.iam.unibe.ch!metz
Universitaet Bern            Phone: (0041) 31 65 49 90
Switzerland		     Fax:   (0041) 31 65 39 65
-- 
Igor Metz                    X400: metz@iamsm.iam.unibe.ch
Institut fuer Informatik     ARPA: metz%iamsm.iam.unibe.ch@relay.cs.net
und angewandte Mathematik    UUCP: ..!uunet!mcsun!iamsm.iam.unibe.ch!metz
Universitaet Bern            Phone: (0041) 31 65 49 90