BSE
  Watcom C/C++
  Perl
   Examples
   Tutorials
  Imager
    Imager::Graph
  ImUgly
  Contact Us
 

The simplest way is to put the functions in a file, and require the file:

    foo1.pl

    use strict;
    use warnings;
    
    sub foo {
      print "This is the foo() function\n";
    }
    
    1;
    

And you can call foo() in the same way that prog1.pl does:

    prog1.pl

    #!/usr/bin/perl -w
    # simple program to call foo() defined in foo1.pl
    use strict;
    require "foo1.pl";
    
    foo();
    

This has some limitations: