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

I'm sure there's an obvious solution, but I'm a beginner and can't figure it out. When I have a line such as "use strict;" or "use warnings;" in my program, I get a "Can't locate strict.pm in INC@ ..." Then when I put my program in the same directory as the strict.pm and warnings.pm files, I get a "Missing $ on loop variable at strict.pm line 103," or a similar error for warnings.pm. Are there some kind of environment settings I'm not aware about? I don't have a clue.

Replies are listed 'Best First'.
Re (tilly) 1: using packages/modules
by tilly (Archbishop) on Feb 22, 2002 at 03:49 UTC
    Try perl -v and perl -V out to find out what kind of Perl you have. From the "missing $" error I suspect that it is from an earlier version of Perl than your modules.

    Also try:

    perl -e 'print map qq($_\n), @INC'
    (use " instead of ' if you are on Windows) to see what Perl thinks its search path for modules is. The fact that you don't have any strict.pm available suggests that Perl's library is misplaced. (Can easily happen if someone mounted Perl on a network drive...) If you know where the modules are supposed to be, one hack to get your scripts to work is to put this at the start of your script:
    BEGIN{ push @INC, "/path/to/modules"; }
    This is kind of like a use lib, except that Perl doesn't need to know where lib is to get it to work. :-)

    Alternately you could just save yourself the headache and reinstall Perl.

Re: using packages/modules
by Zaxo (Archbishop) on Feb 22, 2002 at 01:47 UTC

    That sounds as though perl was not properly installed. Could you provide more information about your OS, Perl distribution, etc?

    After Compline,
    Zaxo