This is really clever and should be included in List::Util: https://rt.cpan.org/Ticket/Display.html?id=150773.my @b = @{ reduce { push @$a, $b if !@$a || $b ne $a->[-1]; $a } [], @ +a };
In reply to Re^4: reduce like iterators
by Anonymous Monk
in thread reduce like iterators
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |