SPUG: File::Basename vs. File::Spec

Bill Campbell bill at celestial.com
Tue Jan 20 12:54:08 PST 2009

On Tue, Jan 20, 2009, Christopher Howard wrote:
> Question: if I know my application is working with Unix filenames, which  
> is better: File::Basename or File::Spec (or some other core module)?
> Basically, all I want to do is split a full path into directory portion  
> and file portion, make an adjustment to the file portion, and then  
> recombine them back into the full path.

If you are going to do this generally, I think you need both.
File::Basename to separate into the parts, and File::Spec to put
the results back together again.

INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186

The Income Tax has made more Liars out of American people than Golf has.
    Will Rogers

More information about the spug-list mailing list