Graham Barr wrote:
> But I have lost count of the number
> of times I have wanted to do
>
>   if ((my $foo = bar()) eq 'foo') {
>     ...
>   }
> 
>   if ($foo eq 'bar') {
>     ...
>   }
> 

To be contrasted with:

while (my($k, $v) = each %h1)
{
  ...
}

while (my($k, $v) = each %h2) # error?
{
  ...
}

Of course, there's an alternative now, using for, ->, and pairs.


Dave.

Reply via email to