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...
dmm