Use temporary array to do basename() function