in reply to splitting a sequence using unpack
This splits using a regular expression, matching between 1 and 3 characters per "chunk", and it'll endeavour to match as many characters per chunk as possible.#!/usr/bin/perl use warnings; use strict; use Data::Dumper; while(<DATA>) { chomp; my @triplets = $_ =~ /(.{1,3})/gs; print Dumper \@triplets; } __DATA__ atgcatccctttaat tctgtctga
|
|---|