chrismassey
Programmer
Hello,
I am trying to take a path i.e. z/files/system/system1
I want to remove the last part of the file i.e. /sytem1
So I left with the rest of the pat i.e. z/files/system
However, I am trying to avoid using a module. Below is a section of a larger script which performs this task...
When I debug the code, I find that some of the white space hasn't been removed by the join function.
- How can I remove this white space?
- What module is best for performing this task? Could this be done using File::Basename?
Thank you,
Chris
I am trying to take a path i.e. z/files/system/system1
I want to remove the last part of the file i.e. /sytem1
So I left with the rest of the pat i.e. z/files/system
However, I am trying to avoid using a module. Below is a section of a larger script which performs this task...
Code:
##### if up one level button pressed
if ($up_one_levelb) {
##### place path onto another variable
$rename_direc_pageb_pathb = $open1;
##### check the file that is opening exists
if (-e "$initial_path$rename_direc_pageb_pathb") {
##### split the path string into its individual elements
(@rename_direc_pageb_path2)=split(/\//,$rename_direc_pageb_pathb);
##### remove the last element of the array
pop(@rename_direc_pageb_path2);
##### for each of the remaining elements, divide them again
foreach (@rename_direc_pageb_path2) {
$_ = "$_/";
}
##### remove white space between elements by joining them together
my $rename_direc_pageb_path3 = join(// ,@rename_direc_pageb_path2);
##### end check the file that is opening exists
}
##### else
else {
print "<font face=arial size=2><P>Directory Does Not Exist... Error 5.</font>";
##### end else
}
##### path =...
$path = $initial_path .''. $rename_direc_pageb_path3;
##### path_carry =...
$path_carry = $rename_direc_pageb_path3;
##### end if up one level button pressed
}
When I debug the code, I find that some of the white space hasn't been removed by the join function.
- How can I remove this white space?
- What module is best for performing this task? Could this be done using File::Basename?
Thank you,
Chris