in reply to Re^2: Platform Independent Directory Traversal
in thread Platform Independent Directory Traversal

print File::Spec->rel2abs( File::Spec->catdir( dirname(__FILE__), File::Spec->updir(), ) );
Bah, that is ugly! I'd do it another way.

Did you know that rel2abs takes an optional second parameter, the reference directory? So, a much cleaner way (IMO) to do this is:

print File::Spec->rel2abs( File::Spec->updir, dirname(__FILE__) );
Even though you probably can just do
print dirname(dirname(File::Spec->rel2abs(__FILE__)));
You may probably even drop the rel2abs call, in this specific case, as __FILE__ would appear to return an absolute path – even though I don't quite trust that to always be the case.
print dirname(dirname(__FILE__)); # ?? Is this reliable?

All code snippets, mine and yours, show the same string in my test.