Quiz on Packages

Check your understanding of classes in Perl by solving the quiz in this lesson.

1

What are the member variable names for the following package?

package person;

sub new {     # constructor
   my $class = shift;
   my $self = {
      name  => shift,
      address => shift,
   };
   
   bless $self, $class;
   return $self;
}
A)

name and $self

B)

bless and $class

C)

name and address

D)

None of the above

Question 1 of 30 attempted

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy