in reply to remove the part of the string that is after the second to last '/'
Yes, it's silly and not portable. I'm just covering a base here. :-)chomp($str = `dirname $str`);
The dirname method in File::Basename would be a good choice if you are in fact manipulating directory paths. This module is reasonably platform independent and part of the core Perl distribution.
Do "perldoc File::Basename" for more information.use File::Basename; my $dir = dirname($filename);
|
|---|