http://www.perlmonks.org?node_id=1007994
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello Perl Monks
I wrote a code to get the absolute paths of the files in a directory,but I get the path showing the files as present in current directory. Eg: Here, I'm using the directory Cluster1 on the desktop with files doc.txt,volt.txt and holiday.txt. The absolute path should be C:\\Users\\Me\\Desktop\\Cluster1\\doc.txt. But, I get the output as D:\Prog\Perls\doc.txt(D:\Prog\Perls is the location where I execute my code).

$dirname="C:\\Users\\Me\\Desktop\\Cluster1"; opendir(DIR, $dirname); @FILES= readdir(DIR); foreach $FILE (@FILES){ $fil_path = File::Spec->rel2abs($FILE); print "File path:", $fil_path; } closedir DIR;
Can you suggest a way to get the absolute path of the file from its original location.(I would also like the path to have 2 escape characters(\\) as a single one doesn't work while accessing a file.)
Thank you.