in reply to strawberry perl and subroutines - subs.pm
Just so you know, perl checks the directories contained in a perl global variable called @INC for any files you include in your program. perl searches each directory listed in @INC for any files you try to use.
By default, @INC contains the current directory ".", as well as certain directories that were created when you installed perl. If you want to see what directories are in @INC, you can print them out:
for my $dir (@INC){ print "$dir\n"; }
You can always add directories to @INC yourself--if perl is unable to find your files. For instance,
unshift @INC, "C:\strawberry\perl";
That will add your directory to the front of the @INC array. That may also take care of your name conflict with perl's subs.pm module: perl checks the directories in the order found in @INC, so perl will look in the directory you shoved onto the front of @INC before it checks any other directories, so if one of the other directories contains perl's subs.pm, your version will be found first.
However, it's always best when you are new to a language to preceed variable names, class names, or module names with some unique identifier, e.g. "MY", so that you don't run into conflicts with built in names. Conflicts between user defined names and built in names can be hard to track down in any language.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: strawberry perl and subroutines - subs.pm
by Anonymous Monk on Dec 20, 2010 at 20:28 UTC |