in reply to change the end of a path inside file
use File::Spec.
The splitpath method will seperate the file name from the directory. Take the file it returns, decrement it, and use the catpath method to rebuild the path.
This solution will be portable across most systems.
Hope this helps!
--jwest
The splitpath method will seperate the file name from the directory. Take the file it returns, decrement it, and use the catpath method to rebuild the path.
This solution will be portable across most systems.
This way is a little pedestrian, but it gets the job done.use File::Spec; my ($volume, $path, $file) = File::Spec->catpath($path_to_decrement); --$file; my $newpath = File::Spec->catpath($volume, $path, $file);
Hope this helps!
--jwest
-><- -><- -><- -><- -><- All things are Perfect To every last Flaw And bound in accord With Eris's Law - HBT; The Book of Advice, 1:7
|
---|
In Section
Seekers of Perl Wisdom