I don't know why I would *ever* do this, I could do it just as well with scalars and arrays, but *sigh*, this course I'm in requires it.
open SRECORD, "srecord.txt" or die "Cannot open srecord.txt: $!";
print "STUDENT LIST\n\n";
my %information = (total => 0,
male => 0,
female => 0,
outof => 0,
other => 0,
over => 0,
under => 0);
while (<SRECORD>) {
chomp;
my $record = substr($_, 0 ,1);
if ($record eq 'U') {$information{'total'} => 'total' + 1;}
if ($record eq 'S') {
$information{'total'} = >'total' + 1;
That's a snippet of the code... But when I print the hash, "total" always equals 1. What am I doing wrong?
Tags: