use File::Spec; my $dir = (File::Spec->splitdir($bla))[3];