#!/usr/bin/perl -w # Finding substring starting with [AG]TG followed by any number of character but ending with T[AG][AG]. # Getting the output of each substring, its length and locating its position from left to right # by number with starting position as zero @d = “CCATGNNNTAACCNNATGNNTAGCC”; use 1.010; my $string ="@d"; # Remove whitespace $string=~ s/\s//g; $x= () =$string=~ /[AG]TG.*T[AG][AG]/ig; say $_ for map{("%d('%S')",length,$_)}split/$x/,$string; my @a=$_ for map{("%d('%S')",length,$_)}split/$x/,$string; print "The sequences and their lengths are:\n @a \n"; exit;