Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL import Function



Syntax

import LIST


Definition and Usage

There is no builtin import function. It is just an ordinary method (subroutine) defined (or inherited) by modules that wish to export names to another module. The use function calls the import method for the package used.

Return Value

  • Nothing.

Example

Try out following example:

#!/usr/bin/perl

package Util;
use base 'Exporter';

our @EXPORT_OK = ('foo', 'bar');

sub foo {
    print "foo!";
}
sub bar {
    print "bar!";
}

package Amy;
use Util 'foo';  # only import foo()
foo();           # works fine
bar();           # blows up



Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names