in reply to Re: Removing recurring consecutive element
in thread Removing recurring consecutive element

To me it seems you want the first word of each string.
No Skeeve. That's not what I want. Instead of this:
$VAR1 = ['A','B','C','A'];
I am looking for this:
$VAR1 = ['A','B','C','A','B'];
So you can see. For the last array I want to keep the 'last word', which is B. I hope that's clearer for you now.

---
neversaint and everlastingly indebted.......

Replies are listed 'Best First'.
Re^3: Removing recurring consecutive element
by monkfan (Curate) on Oct 13, 2005 at 07:22 UTC
    If that's what you want. Add this one line after Skeeve's.
    push @str, (split ' ',$tpl->[-1])[2];
    Sorry I still don't know if this implementation gives the fastest running time.

    Regards,
    Edward