Re: Finding directory my perl program was loaded from

Discussion in 'Perl' started by Jürgen Exner, Oct 13, 2009.

  1. [comp.lang.perl has been rm-grouped some 15 years ago. If your ISP still
    carries this instead of comp.lang.perl.* you should wonder what else you
    are missing.]
    [x-post and f'up to comp.lang.perl.misc]

    See the second and following parts of "perldoc -q directory":
    "How do I add the directory my program lives in"
    If you don't call the perl interpreter explicitely but just use
    " ..." then you should find the full path in $0.
    Extracting the directory from $0 is trivial using functions from
    Well, $ENV{PATH} does play a major role in deciding which executables to
    use, so you cannot just ignore it.

    Jürgen Exner, Oct 13, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.