in reply to Re^2: Pulling out an element from a function return without using an intermediate list
in thread Pulling out an element from a function return without using an intermediate list

On the other hand, the following versions all work:

my $aa; my $bb; (undef, $aa, $bb) = dir();
my ($aa, $bb); (undef, $aa, $bb) = dir();
(undef, my $aa, my $bb) = dir();
(undef, my ($aa, $bb)) = dir();
my ($aa, $bb) = ( dir() )[1, 2];

Update: Apparently, so does the following (contrary to the parent's claims):

my (undef, $aa, $bb) = dir();

Tested the last one on Perl 5.6.0, 5.6.1, 5.8.0 and 5.8.8.

  • Comment on Re^3: Pulling out an element from a function return without using an intermediate list
  • Select or Download Code