Help for this page

Select Code to Download


  1. or download this
    my @b = @{ reduce { push @$a, $b if !@$a || $b ne $a->[-1]; $a } [], @
    +a };
    
  2. or download this
    my @b = list_reduce { push @$_, $b if !@$_ || $b ne $_->[-1]; undef } 
    +undef, @a;
    
    ...
    my @b = list_reduce { push @$_, $b if defined($b) && $b ne $a; $b } un
    +def, @a;
    
    my @b = list_reduce { push @$_, grep defined && $_ ne $a, $b; $b } und
    +ef, @a;