in reply to Re: Re: Extracting file name from path
in thread Extracting file name from path

Good advice dimmesdale, same with all the rest. But one point:

However, trying to find the last \, like in this example, could probably be made simpler by a call to reverse

Close, but why not rindex. Take this example:

$file = substr($path, 1 + rindex($path,'\\'));
It finds the last \ in the string and asigns everything after that.

That said, I would definately use something like File::Basename if you plan on using this script more than once.

The 15 year old, freshman programmer,
Stephen Rawls