Subroutine library calls in Perl
Posted on 2003-11-20
In Perl, I have created a file containing several shared subroutines ("subrout.lib") and then including the command "require 'subrout.lib';" in each script that references one or more of the subroutines. That works well except when a script calls itself (for instance, to replot the screen with the data sorted differently). It clearly accesses the subroutines the first time, but does not access them in subsequent calls.
When I include the shared subroutines in each script, everything works fine. That obviously increases the size of my scripts and is no fun to maintain. Before I proceed, I thought I would ask what is the best way to (a) set up a library of subroutines and (b) call a subroutine from that library.