Graham Barr wrote:
>Maybe not with 3 variables, but how many people do
>
>  my %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
>
>  { ... }


I'm not seeing an earth-shattering advantage of:

        for my($k,$v) (%hash) 
over
        while(my($k,$v) = each %hash) 
        
AFAICT, they act the same, just look a little different. 
Eight characters difference, counting whitespace.

>
>Also the ability to traverse multiple lists at once
>
>  for ($a,$b,$c) (zip(@a,@b,@c)) { ... }

I don't get it. This is a great advantage over:
   @looparray = zip(@a,@b,@c);
   while ( ($a,$b,$c) = splice (@looparray, 0, 3))
?

I'm thinking that if I were implementing such a loop, I'd probably
have set up my data structures so that instead of three arrays, I'd
have one array of three hash elements, and iterate over it:

    for $iter (@data)
    {
        foo ($iter->{a}, $iter->{b}, $iter->{c});
    }

People keep proposing bells, whistles, antennae, and tentacles
for the "for" statement, and I haven't seen one yet that had
seemed justified to me.  

 ----------------------------------------------------------------------
 Eric J. Roode,  [EMAIL PROTECTED]           print  scalar  reverse  sort
 Senior Software Engineer                'tona ', 'reh', 'ekca', 'lre',
 Myxa Corporation                        '.r', 'h ', 'uj', 'p ', 'ts';

Reply via email to