That bit is just charging up the magic wand. It can just as well be a separate statement:
$| = 1;
print grep --$|, /\b(\w+)\b(?=(.*?)\b\1\b)/g'
To get even elements instead of odd elements, you just start with the magic wand in the other position:
print grep --$|,($|&&=0)|| /\b(\w+)\b(?=(.*?)\b\1\b)/g'
or:
$| = 0;
print grep --$|, /\b(\w+)\b(?=(.*?)\b\1\b)/g'
Why ||= and &&= instead of = is left as an excercise for the reader.
Hope that clears things up for you :) |