Perl modules

Exporting functions

Hello3.pmprogram3.pl
package Hello3;
use strict;
require Exporter;

our @ISA=“Exporter”;
our @EXPORT_OK = qw(greet);
our $var1 = 1;
my $var2 = 3;
my $str = "Hello World!\n";

sub greet {
   return $str;
}

1;
#!/usr/bin/perl

use Hello3 qw(greet);

print "var1= $Hello3::var1\n";

print "var2= $Hello3::var2\n";

print greet();


Table of Contents.
Previous | Next.