in reply to using "require" problem

Hello gauss76,

Normally you will put your routines into a module: Routines.pm will be the name of the file with inside a package called Routines You can use Exporter to export, possibly just on demand, one or more subs.

Consider also that current directory . is no more included in @INC in newer Perl version for security reasons: you can include it with use lib '.'; (or adding it directly to @INC or using the -I perl switch) PS this is probably unrelated (see below) but important to know anyway

Look at my homenode for many links about modules and code reuse: especially require "shared.pl" with use strict; and Include subs from different perl file

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: using "require" problem
by haukex (Archbishop) on Sep 26, 2017 at 08:03 UTC
    Consider also that current directory . is no more included in @INC in newer Perl version for security reasons: you can include it with use lib '.'

    While correct, the way I understood the question is that the working directory is changing, so I don't think that would help here - but this pattern would, which I've used many times:

    use FindBin; use lib $FindBin::Bin; use Routines;