in reply to Extracting filename from a path string
What about the venerable, File::Spec?
Or, as a teaching exercise go right ahead and reinvent the wheel...
dmmGIVE a man a fish you feed him for a day
TEACH him to fish and you feed him for a lifetime