DB<3> use feature "state"; print map { state $p; $p ne $_ ? $p = $_ : () } (a,a,a,a,b,c,c,a,a,d,e,e,e,e) abcade