in reply to split a squence by 3 letters

Yet another one:

my $seq = 'ACTGACTGATGCATGCATGCATGCCGTACGTACGTACGT'; my @groups = unpack "(A3)*", $seq;

(But before you generalize this method, note that pre-5.10.0, unpack's "A" template would unpack bytes, not characters... which would make a difference when unicode is involved. This is irrelevant in this particular case, though.)