Mighty perl monks, do you have anty suggestions on how to make the following subroutine, and the following part of my code, case insensitive. I know that it sounds trivial but I had problems doing it.
sub get_Hx{ my $site = $_[0]; my $no_of_sequences =length($site); my $sum = 0; foreach(qw/A C D E F G H I J K L M N P Q R S T V W Y _ \./){ my $count = () = $site =~ /$_/g; $sum += -($count/$no_of_sequences)*log_2($count/$no_of_sequences) +if($count > 0); } return $sum; }
also I nedd the same thing for the next block of code.
my $site1; my $site2; my $l=0; foreach $site1 (@site1) { my @site1_parts = split(//, $site1); $l++; my $j=0; my $mutual; my $Hx= get_Hx($site1); #print "$Hx\n"; foreach $site2 (@site2) {#begining of loop2 for each site 2 $j++; my $Hy = get_Hx($site2); my $Hxy; my %counts; my @count_collection; my @site2_parts = split(//, $site2); my $i = @site1_parts; $counts{get_index($site1_parts[$i], $site2_parts[$i])}++ while + ($i--); push(@count_collection, \%counts); foreach my $counts (@count_collection) { my $total; foreach (sort keys %$counts) { #print "$counts{$_}\n"; my $freq = $counts->{$_}/length($site1); my $MI = -$freq * log_2$freq; #$total +=$freq; $Hxy +=$MI; } #print "$Hxy \ $Hx\ $Hy \n"; $mutual = $Hx + $Hy - $Hxy; } print " $l,$j,$mutual\n"; #print " $l,$j\n"; #print($_, ': ', $counts{$_}, $/) foreach (sort keys %counts); #print($/); }#end of loop2 for each site2 }
By case insensitive I mean that whenever my program finds an A or an a it should do countA +2 and not two different counters. Thanks for anyone's help

In reply to making my suroutine and parts of my program case insensitive. by replicant4

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.