<?xml version="1.0" encoding="windows-1252"?>
<node id="1008028" title="Re: How to get full path name in windows?" created="2012-12-09 22:59:02" updated="2012-12-09 22:59:02">
<type id="11">
note</type>
<author id="918402">
2teez</author>
<data>
<field name="doctext">
&lt;p&gt;

Am adding just a "kobo" suggestion, using your OP and the modification provided by [ww] to your script.&lt;br&gt;&lt;br&gt;
[Anonymous Monk] says:&lt;br&gt;
&lt;b&gt;&lt;i&gt;"..D:\Prog\Perls is the location where I execute my code.."&lt;/i&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;
In that case, you can get your desired result using [doc://chdir]. &lt;tt&gt;&lt;c&gt;{&lt;/c&gt;Updated&lt;c&gt;}&lt;/c&gt;&lt;/tt&gt;&lt;br&gt; Like so:
&lt;c&gt;
#!/usr/bin/perl
use warnings;
use strict;
use File::Spec;

my $dirname = "C:\\Users\\Me\\Desktop\\Cluster1";
my @file_to_use_later;    ## for use later
chdir $dirname;           ## add this to OP script

opendir DIR, $dirname or die "can't open directory: $!";
my @FILES = readdir(DIR);
foreach my $FILE (@FILES) {
    my $fil_path = File::Spec-&gt;rel2abs($FILE);
    print "File path:", $fil_path, $/;
    push @file_to_use_later, $fil_path if -f $fil_path;    ## check files contents later
}
closedir DIR or die "can't close directory: $!";

## test the files stored in the array variable later

for my $filename (@file_to_use_later) {
    print $filename, $/;
    open my $fh, '&lt;', $filename or die "can't open: $!";
    while (&lt;$fh&gt;) {
        chomp;
        print $_, $/;
    }
    close $fh or die "can't close file:$!";
}
&lt;/c&gt;
&lt;br&gt;
Also, take note of this important info from [doc://File::Spec] documentation about the "rel2abs".&lt;br&gt;
&lt;tt&gt;
&lt;b&gt;rel2abs()&lt;/b&gt;
Converts a relative path to an absolute path.
&lt;c&gt;
    $abs_path = File::Spec-&gt;rel2abs( $path ) ;
    $abs_path = File::Spec-&gt;rel2abs( $path, $base ) ;
&lt;/c&gt;
If $base is not present or '', then [doc://Cwd] is used. If $base is relative, then it is converted to absolute form using rel2abs(). This means that it is taken to be relative to [doc://Cwd].&lt;br&gt;&lt;br&gt;
On systems with the concept of volume, if $path and $base appear to be on two different volumes, we will not attempt to resolve the two paths, and we will instead simply return $path .
&lt;/tt&gt;&lt;br&gt;
The above explain, why you are getting this:
&lt;c&gt;
D:\Prog\Perls\doc.txt
D:\Prog\Perls\volt.txt
D:\Prog\Perls\holiday.txt
&lt;/c&gt; instead of this
&lt;c&gt;
C:\Users\Me\Desktop\Cluster1\doc.txt
C:\Users\Me\Desktop\Cluster1\volt.txt
C:\Users\Me\Desktop\Cluster1\holiday.txt
&lt;/c&gt;
&lt;b&gt;Update:&lt;/b&gt;&lt;br&gt;
You may also want to look into the module [cpan://Path::Class] and it's "cousins".&lt;br&gt;  [cpan://Path::Class] 'just' is a "wrapper" for [doc://File::Spec].
&lt;/p&gt;
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-918402"&gt;
If you tell me, I'll forget.&lt;br&gt;
If you show me, I'll remember.&lt;br&gt;
if you involve me, I'll understand.&lt;br&gt;
--- Author [unknown to me]
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1007994</field>
<field name="parent_node">
1007994</field>
</data>
</node>
