• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Determining the path a file resides in

Say I run a perl script from the home directory like so:

perl /some/path/scriptname

How do I determine the "/some/path" from inside scriptname?
0
Asdf
Asked:
Asdf
1 Solution
 
Perl_DiverCommented:
use FindBin qw($Bin);
print $Bin;

http://perldoc.perl.org/FindBin.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now