use File::Basename qw/ dirname /; my $path = dirname($fullpath);