I get this error when running my perl code
Can't locate File/Glob.pm in @INC (@INC contains: D:/tools/lib .) at directory.pl line 2.
line 2: @files=<*>;
When i run the command, I get,
Y:\perl\开发者_开发百科perl>perldoc -l File::Glob
D:\tools\lib\perl\510\File\Glob.pm
So I think the File::Glob module is installed?
@INC
should be set correctly upon installation of Perl. When it doesn't match your configuration, you seem to have messed up something.
However, if the current value of @INC
doesn't fit your needs, you have various options:
- Add
D:\tools\lib\perl\510\
to the environment variablePERL5LIB
(orPERLLIB
if this doesn't work) - Specify
@INC
on startup:perl -I D:\tools\lib\perl\510\
- Instead of writing
use libname
, you can writeuse path/to/libname
Using a
BEGIN
block before theuse
statements:BEGIN { push @INC,"D:\tools\lib\perl\510\"; }
See also http://perldoc.perl.org/perlvar.html for a short introduction.
精彩评论