Question

I know this is a silly question. I have been using Perl now for about 2 months, and I'm interested in perldoc. I used man perldoc to find out how to use it, and tried to find documentation on the @ISA variable.

But when I do:

$perldoc -v @ISA

It says

No documentation for perl variable '@ISA' found

Am I using the perldoc right? Or do I need to install something?

Was it helpful?

Solution

perldoc -v checks perlvar, but @ISA isn't document there, unfortunately.

@ISA is documented in perlobj. It's checked during method resolution to obtain a list of the class's parent classes.

{
   package Base;
   sub new {
      my ($class) = @_;
      my $self = bless({}, $class);
      return $self;
   }

   sub do {
      print("do\n");
   }
}

{
   package Child;
   our @ISA = 'Base';
}

Child->new()->do();  # @ISA is consulted to locate "new" and "do".
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top