#!/usr/bin/perl
use strict;
use warnings;

# initializing variables
my $dna_seq = "ATGCATTGGGGAACCCTGTGCGGATTCTTGTGGCTTTGGCCCTATCTTTTCTATGTCCAAGCTG".
              "TGCCCATCCAAAAAGTCCAAGATGACACCAAAACCCTCATCAAGACAATTGTCACCAGGATCAA";
my %NUCLEOTIDES = ();

# Looping throught the sequence
my @sequence = split //, $dna_seq;
my $seqlen = scalar(@sequence);
for (my $i = 0; $i < $seqlen; $i++) {
    $NUCLEOTIDES{$sequence[$i]}++;
};

# Printing results
foreach my $nucleotide (sort keys %NUCLEOTIDES) {
    print STDOUT "Total $nucleotide = $NUCLEOTIDES{$nucleotide}\n";
};
