#! /usr/bin/perl -w use strict; my (@genes, @positions); my $screen = "ATCGATCGXXXXXATCGATXXXACTGCTACGGTACXXXAATTATXGCGCGXXT"; if ($screen =~ /X/) { my @parts = split /(X+)/, $screen; my $pos = 0; foreach my $part (@parts) { if ($part !~ /X/) { push @genes, $part; push @positions, $pos; print "Gene $part is at position $pos\n"; } $pos += length $part; } my $genecounter = @genes; print "Number of components = $genecounter\n\n"; }