Bzzzt! Crash! This is the sound of the cross-platform compatibility police knocking at your door!
I feel obliged to point out that there is a module that encapsulates the concept of parent directory. Thus your code becomes:
use strict; use warnings; use Cwd; use File::Spec; print Cwd::realpath(File::Spec->updir);
When code begins to involve both Cwd and File::Spec, you know it's time to look at Path::Class (see elsewhere in this thread).
• another intruder with the mooring in the heart of the Perl
In reply to Re^2: how to get the parent directory name?
by grinder
in thread how to get the parent directory name?
by juro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |