#!/usr/bin/perl use strict; use warnings; my $string = 'acacagagatcgctagatcgatcgatcgat'; my @values = $string =~ /(.{3})/g; print $_,"\n" for @values;