- or download this
print "Enter the student's course(s) ";
$self->{"Course(s)"}=[<STDIN>]
- or download this
print "Enter the student's course(s) delimiting
them with a comma (,) ";
...
$cour =~ s/\s+//g;
my @cour = split(",", $cour);
chomp($self->{"Course(s)"}->{"cour"}=[@cour]);
- or download this
sub add_courses {
my $self = shift;
...
for ($i=0; $i<$num; $i++) {
push @{$self->{'Course(s)'}->{'cour'}}, $courses->[$i];
}
- or download this
Here are the statistics for the Sino.
Address: kk
...
Tuition: kk
Course(s): Chem, Bio, Maths, C++, Java
After dropping: Chem, Bio, Maths, , Java
- or download this
package Student3;
sub new { my $class = shift;
...
join (", ", @{$self->{'Course(s)'}->{'cour'}}), "\n";
}
1;
- or download this
#!/usr/bin/perl -w
use Student3;
...
$student1->add_courses(["C++", "Java"]);
$student1->show_student;
$student1->drop_courses(["C++"]);