script to find the current directory

K

Kannan Ekanath

Hi,
stuck up with this real sitter. can someone tell me how to find the full
path of the current directory inside a pearl script (because the script
can be called from different directories i just wanted to know the full
path of the directory i.e, the caller).

saw things like
my @filelist = global("*");
to get the file list...is there any way to get the current directory
Right now i am using the alternative of pwd >> somefile and picking it
up from there

Thanks
Kannan
 
T

Todd de Gruyl

Kannan said:
can someone tell me how to find the full path of the current directory

Here are two ways:

use Cwd; # more portable
my $dir = cwd;

or

my $dir = `pwd`; # assuming unix-like os here
chomp $dir;
 

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,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top