tej has asked for the wisdom of the Perl Monks concerning the following question:

This might be a stupid question but I am very new to Unix environment.

I have a perl script which uses some pm files. All the pm files were in same folder. I ran my script on unix promt, and it gives me error like "Cant Locate Tab_calc.pm in @INC (@INC contans blah blah..)"

I gave command at begining like

BEGIN { unshift(@INC, "\path\modules") }

And i kept all my pm files in folder "modules"

I again got the same error, with only difference that this time @INC had the defined path.

Then I tried

use lib '/path/modules'

I am still getting the same error

What should I do?..

Update: Thanks Everybody..your points really added to my Knowledgebase

Replies are listed 'Best First'.
Re: Perl on Unix
by JavaFan (Canon) on Aug 11, 2011 at 09:38 UTC
    Note that Unix doesn't use a backslash as a path separator. It uses a forward slash. Also note that most Unix filesystems are case sensitive. If you write use Tab_calc;, make sure the module file is called Tab_calc.pm, and not Tab_Calc.pm or tab_calc.pm.
      thanks..it was Tab_Calc.pm and i was writing Tab_calc;
Re: Perl on Unix
by zentara (Cardinal) on Aug 11, 2011 at 12:08 UTC
    No one has mentioned it yet, but
    use lib '.';
    often picks up the local modules, by specifying '.', the current working directory.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: Perl on Unix
by moritz (Cardinal) on Aug 11, 2011 at 09:50 UTC
      Uhm, if you read the rest of the post of the OP, he has already done that (sans syntax error), so I presume he's aware of it.
Re: Perl on Unix
by Anonymous Monk on Aug 11, 2011 at 09:32 UTC

    What should I do?..

    Install the missing module

      Do i need to install all the modules?

      Bacause i have not installed any of the module and have just copied the pm files.

        It might work for many modules, but some modules have parts programmed in C (for speed reasons) and these need to be compiled.

        If you install them, they usually get stored in a location where perl looks automatically so you don't need those 'use lib...' stuff

        Your line

        BEGIN { unshift(@INC, "\path\modules") }

        is not working because backslashes have a special meaning. What you want is

        BEGIN { unshift(@INC, "/path/modules") } or BEGIN { unshift(@INC, "\\path\\modules") }
Re: Perl on Unix
by troy99 (Novice) on Aug 12, 2011 at 10:28 UTC

    Perl doesn't know where to look for the Perl modules. Add the path to the pm's to your PERLLIB environment variable.

    setenv PERLLIB /your/path/:$PERLLIB

    YMMV depending upon which shell you're using.