Hi all,
I am trying to evaluate a string, and determine if the last charater of
the string has a backslash '\' . The piece of code I am using doesn't
appear to work. What I've found with this peice of code is that if the
string does contain a \, then the following code still adds another
slash. If there is not backslash in the string, the the code appears to
work fine by adding a backslash. Any ideas?
print "Deleting old directory $dir_no: $Dir_name\n";
$arg_length = length($ARGV[0]);
$arg_lastchar = substr($ARGV[0], $arg_length-1, 1);
print "last char is: $arg_lastchar\n";
################################################
# add a \ if one was not present in argument #
################################################
if ($arg_lastchar ne '\\' or $arg_lastchar ne '/') {
$Dir_name = '\\' . $Dir_name;
print "Adding \\ to: $Dir_name\n";
}