Perl

Modules and procs

http://en.wikipedia.org/wiki/Perl_module

Foo.pm

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
  package Foo;

  use strict;
  use warnings;

  our $VERSION = '1.00';

  use base 'Exporter';

  our @EXPORT = qw{hello bye};

  sub hello {
    return 'Hello World!';
  }

  sub bye {
    my $name = $_[0];
    return "Bye, $name";
  }

  1;

test.pl

1
2
3
4
  use Foo;

  print &hello;
  print &bye('John');