Assuming that the array has been converted to a scalar, then the
following "Lookaround Assertion" works:

#!/usr/bin/perl

$_ = 'a a a b b c c';

1 while s/\b(\w+) \s (?= \1\b ) //gxi;
print $_, "\n";

The scalar can be reconverted to an array.
Not sure if this is any faster.

Alfred,
Project Breeze
SNPS





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to