$var = "one/two/three/four/five/six/"; split /\//, $var; pop; $var = $var . $_ foreach(@_);