On Mon, Aug 28, 2000 at 04:10:01PM -0400, Eric Roode wrote:
> Peter Scott wrote:
> >Graham Barr once allowed as how he thought it would be neat if you could say
> >
> >     for my($x, $y, $z) (@list) { ... }
> 
> ObLanguageMinimalist:
> 
> Um. Is this so frequently-used that the above syntax is preferable to:
> 
>     while ( ($x, $y, $z) = splice (@list, 0, 3) )   {...}
> 
> ? (notwithstanding the destructive nature of splice)

Maybe not with 3 variables, but how many people do

  my %hash = @_;
  while(my($k,$v) = each %hash) { ... }

so that they can process named arguments ?

Having this would remove the need for the hash assignment. Also it hash been
suggested that it could potentially replace each

  for my($k,$v) (%hash) { ... }

Also the ability to traverse multiple lists at once

  for ($a,$b,$c) (zip(@a,@b,@c)) { ... }

And I should think many more uses I cannot think of.

Graham.

Reply via email to