In a program such as the following....
-----------------------------------------------------------------
#!/usr/local/bin/perl -w


# always always always use strict and warnings!!!
use strict;
use warnings;
use File::Spec;

$windir = "/home/users/tony";

my $windir = '/home/users/tony';

opendir(NT, $windir) || die "no $windir?: $!";

"or die" not "|| die"

while ($name = readdir(NT)) { # scalar context, one per loop

while(my $name...

or better yet:

while(readir NT) {
   my $abs = File::Spec->rel2abs($_);
   print "$abs\n";
}

       print "$name\n"; # prints ., .., system.ini, and so on
}
closedir(NT);
exit;

exit not needed

-------------------------------------------------------------------
$name returns each of the files in the given directory. To form the absolute path of the files given by $name, you would simply combine the $windir and the $name variables like so: "$windir/$name". For example "/home/users/tony/x.txt".

My question relates to the two files '.' and '..'. Is there any function that will give the absolute path of these directories when fed $name values of '.' and '..' ? Without having to chdir to these directories, that is.

perldoc -f File::Spec

HTH :)

Lee.M - JupiterHost.Net

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to