$|=1; # So it works in the Open Perl IDE

if (!open IN,"<big.fas") {      # make sure we can read the file
  die "Couldn't open file: $!";
}

@arr = <IN>; # read the whole thing into an array
close IN; # We're done and don't need the input file anymore
shift @arr; # get rid of the head
chomp @arr; # get rid of the returns at the end of the lines

foreach $e (@arr){
  $dna = $dna . $e; # concatenate the lines into a single string
}                   # actually not neccessary for big.fas

$p1 = index $dna,"ACCTGT"; # get index of first motif
$p2 = rindex $dna,"ACCTGT"; # get index of last motif

$start = $p1 + 6; # we don't want to extract the motif itself
$len = $p2 - $start; # length of the sequence I am interested in

$seq = substr $dna,$start,$len; # get the sequence

print "$seq\nLength of the sequence: $len nts"; # report the outcome

