in reply to Split Function - Positions

Essentially what I wish to obtain is the starting position for each member of the @genes array within the original $screen variable.

I gave a solution using split in an earlier reply. I think I would prefer to solve this with a simple iterative regex, taking advantage of the @- array, which tracks the starting index of each sub-match:

my @genes; my @gene_pos; while ( $screen =~ m/([^X]+)/g ) { push @genes, $1; push @gene_pos, $-[1]; }