Alternative content
#!/usr/bin/perl
sub calculate_gc_content {
my ($sequence) = @_;
$sequence = uc($sequence); # Convert the sequence to uppercase
my $gc_count = () = $sequence =~ /[GC]/g;
my $total_bases = length($sequence);
my $gc_content = ($gc_count / $total_bases) * 100;
return $gc_content;
}
# Example usage:
my $dna_sequence = "ATGCGCTAAAGCGAGCGAAGCGCTAGATCGATCGATCGATCGATCGATCGATCGATCGATCG";
my $gc_content = calculate_gc_content($dna_sequence);
printf "GC content: %.2f%%\n", $gc_content;