in reply to Re: Breaking a script into smaller files
in thread Breaking a script into smaller files

ChemBoy already noted that $0 contains the name of the script, not the name of the current file.

But he didn't point out that including "." includes the current working directory in @INC, which has no connection with the location of the file your code is in. Furthermore including "." explicitly is redundant - Perl includes "." in @INC already.

The information about variables is covered, of course, in perlvar. The __FILE__ literal in perldata. And the knowledge of what directory "." is is covered in any introduction to filesystems.

  • Comment on Re (tilly) 2: Breaking a script into smaller files

Replies are listed 'Best First'.
Re: Re (tilly) 2: Breaking a script into smaller files
by Flame (Deacon) on Nov 13, 2001 at 03:09 UTC
    Well, the question itself did ask for the path to the script... not the current file. Or did I read it wrong?

    Regardles... I was just posting something that had worked for me when I needed a similar problem solved.

    If what I said was completely wrong, though, thank you for pointing it out.


    -----BEGIN GEEK CODE BLOCK-----
    Version: 3.12
    GIT d- s:++ a--- C++++ UL P+++>++++ L+ E- W++>+++ N !o K- w+ O---- M-- V--
    PS PE Y- PGP t++(+++) 5(+++)++++ X R+@ tv+ b+++ DI+ D- G e->+++ h! r-- y-
    ------END GEEK CODE BLOCK------
    Translate

    "Weird things happen, get used to it."

    Flame ~ Lead Programmer: GMS