# get the base name of the path. $path =~ m~^[\w/]+/(\w+)$~; $basename = $1; #### $basename = basename($path);