The issue is, I need it to count the number of student, females and males but I can't get my count to work correctly. Can someone steer me in the right direction as to what I'm doing wrong. I just want it to print the counts of each on their own line. The script I wrote is below.

open SRECORD, "srecord.txt" or die "Cannot open srecord.txt: $!";

my $count = 0;

while (<SRECORD>) {
my @list = ('my $record', 'my $gender');
chomp;
my $record = substr($_, 0 ,1);
my $gender = substr($_, 81, 1);

{
$list[0]++;
print "$list[0] Students\n";
$count++ if $record eq 'S'
}
if ($gender = 'F')

{
$list[1]++;
print "$list[1] Females\n";
}

if ($gender = 'M')
{
my $count = $list[1]++;
print "$count Males\n";
$count++;

}
}
close SRECORD;