develooper Front page | perl.perl5.porters | Postings from March 2000

for my($x,$y) (@array) { ... }

Thread Next
From:
Graham Barr
Date:
March 1, 2000 08:03
Subject:
for my($x,$y) (@array) { ... }
Message ID:
20000301160230.D406@pobox.com
First off I am not suggesting that this be added.

But is there an interest for the following code

  @array = (1,2,3,4);
  foreach my($x,$y) (@array) {
    print "$x $y\n";
  }

which outputs

  1 2
  3 4

I have the beginnings of a patch for this, which supports any number of variables not just 2,
although it can probably be improved a great deal.

Graham.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About