Help for this page

Select Code to Download


  1. or download this
    my @arr = (4, 1, 6, 4, 3, 7);
    my %saw;
    @saw{ @arr } = ();  # The line I'm not understanding
    my @new_arr = keys %saw;
    print sort @new_arr;
    
  2. or download this
    my @arr = (4, 1, 6, 4, 3, 7);
    my %saw = map{ $_ => undef } @arr;
    my @new_arr = keys %saw;
    print sort @new_arr;