use strict; use warnings; my @strings = qw/xxxx xxxyy/; for( @strings ) { print "$_\n" unless /^(.)\1*$/; }