How to get the exact path of a script

V

vikrant

hi,

i have a script example.pl currently store at location "/home/vikrant/scripts/".

Now,what i want to do is to find the above path means where
my script(example.pl) store or currently exists when i run
my script(example.pl) in the following different ways:-

1.
cd /home/
perl vikrant/scripts/example.pl

the output i need is /home/vikrant/scripts/

2.
cd /home/sameer/
perl /home/vikrant/scripts/example.pl

this time the output i need is same means "/home/vikrant/scripts/".

Please tell me how can i get the exact path of my script
while executing it from different location.

Thanks

Vikrant
 
A

Anno Siegel

hi,

i have a script example.pl currently store at location "/home/vikrant/scripts/".

Now,what i want to do is to find the above path means where
my script(example.pl) store or currently exists when i run
my script(example.pl) in the following different ways:-

perldoc FindBin

Anno
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top