Here are the statistics for the Sino.
Address: kk ID: kk
<...continues...>
Course(s): Chem, Bio, Maths, C++, Java
After dropping: Chem, Bio, Maths, , Java
####
package Student3;
sub new { my $class = shift; my $ref = {};
# Anonymous hash
bless($ref, $class);
return $ref; }
sub set_student {
my $self = shift;
<...continues...>
print "Enter the student's course(s) delimiting them
with a comma (,) ";
chomp(my $cour = );
$cour =~ s/\s+//g;
my @cour = split(",", $cour);
chomp($self->{"Course(s)"}->{"cour"}=[@cour]);
<...continues here...>
}
<...continues...>
sub drop_courses {
my $self=shift;
my $del_cour = shift;
# $student1->drop_courses(["C++"]);
my $num = @{$del_cour};
if ($num == 1) {
foreach $k (@{$self->{'Course(s)'}->{'cour'}}) {
if ($k eq $del_cour->[0]) {
$k="";
}
}
}
print "After dropping: ",
join (", ", @{$self->{'Course(s)'}->{'cour'}}), "\n";
1;
####
#!/usr/bin/perl -w
use Student3;
use warnings;
use strict;
my $student1 = Student3->new;
$student1->set_student;
$student1->show_student;
$student1->add_courses(["C++", "Java"]);
$student1->show_student;
$student1->drop_courses(["C++"]);