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