in reply to Current Directory

It took me three times reading that to figure out what you were trying to say.

In any case, the general question you ask about finding, given a directory, its parent directory, is best done through using File::Spec. Actually, though, if you're going to be using it anyway, you probably want to use it in the snippet of code you already posted. This code gets you $currdir as before, its parent, and the parent of that:

BEGIN { use File::Spec; use strict; my ($currdir, $currdirp, $currdirpp); my ($zvolume, $zdirs, $zfile) = File::Spec->splitpath( File::Spec->rel2abs($0) +); my @dirs = File::Spec->splitdir($zdirs); $currdir = File::Spec->catpath($zvolume, $zdirs, ''); pop @dirs; $currdirp = File::Spec->catpath($zvolume, File::Spec->catdir(@dirs), + ''); pop @dirs; $currdirpp = File::Spec->catpath($zvolume, File::Spec->catdir(@dirs) +, ''); # Now do something with those variables. }
--
@/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/