SPUG: Calling a file as a sub-routine?

Jay Scherrer jay at Scherrer.com
Thu Jul 12 14:30:01 CDT 2001


How can I call a separate .pl file into the main as a sub-routine?
I am trying to create separate reusable files instead of listing all of
the routines as subs in a large program.

How do I set up a separate file called outside.pl and then use it as a
subroutine inside the main program called mainProgram.pl?
example:
outside.pl
sub outside {
do something;
}

mainProgram.pl
#!/usr/bin/perl -w
require "outside.pl";
if ($foo = $bar) {
outside.pl;
}

Jay


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list