Rob Dixon schreef:

>   $uniq{$_} =  1 foreach @holdArr;

I prefer "foreach" to "for", mainly because it is shorter.

Alternative:

    @[EMAIL PROTECTED] = (1) x @holdArr;


Test-1:

perl -MData::Dumper -wle'
  @keys = qw(a b c) ;
  @hash{ @keys } = (1) x @keys ;
  print Dumper \%hash
'
$VAR1 = {
          'c' => 1,
          'a' => 1,
          'b' => 1
        };


Test-undef:

perl -MData::Dumper -wle'
  @keys = qw(a b c) ;
  @hash{ @keys } = () ;
  print Dumper \%hash
'
$VAR1 = {
          'c' => undef,
          'a' => undef,
          'b' => undef
        };

-- 
Affijn, Ruud

"Gewoon is een tijger."

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to