in reply to Split Function - Positions

Will this do what you want?

use strict; my @genes; my $screen = "ATCGATCGXXXXXATCGATXXXACTGCTACGGTACXXXAATTATXGCGCGXXT"; while ($screen =~ /(^|(?<=X))([^X]+)/g) { print "Gene $2 found at position ", length($`), "\n"; }

Update: added $2 gene string.