191

Packages & Modules
Exporting Symbols

  • The use function will export a list of symbols from a module given a few added statements inside a module

      require Exporter;
      @ISA = qw(Exporter);

  • Then, provide a list of symbols (scalars, lists, hashes, subroutines, etc) by filling the list variable named @EXPORT

      @EXPORT = qw(bar blat);


    Exercise
    1. Take a look at the "Module2.pm" script (click the "Module2.pm" icon).
    2. Run the use example script.
    3. Take a look at the "use" script (click the "use" icon).

    Module2.pm

    use