Hi,

Akim Demaille <[EMAIL PROTECTED]> writes:
> +    while (my ($attr, $value) = each %option)
>      {
[snip]
> +      if ($attr eq 'ansi')
>       {
> +       $lang_obj->ansi ($value);
>       }
> +      elsif ($attr eq 'autodep')
>       {
> +       $lang_obj->autodep ($value);
>       }
> +      elsif ($attr eq 'compile')
> +     {
> +       $lang_obj->compile ($value);
> +     }
[snip]

Wouldn't this be more compact and readable without the loop?

  $lang_obj->ansi    ($options{'ansi'})    if exists $options{'ansi'};
  $lang_obj->autodep ($options{'autodep'}) if exists $options{'autodep'};
  $lang_obj->compile ($options{'compile'}) if exists $options{'compile'};
  # ...

  delete $options{$_} for (('ansi', 'autodep', 'compile', ...));
  complain(...) if (keys %options);

- Hari
-- 
Raja R Harinath ------------------------------ [EMAIL PROTECTED]
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash

Reply via email to