[EMAIL PROTECTED] wrote:
>
> Thanks to all of you. Problem solved !
$last_char = chop $dir;
--
,-/- __ _ _ $Bill Luebkert ICQ=14439852
(_/ / )// // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // http://dbecoll.tripod.com/ (Free site
Thanks to all of you. Problem solved !
Kwabena
Hi,
How do you extract the last character of a string
I basically want to see if a list of directory strings have a slash at the end
or not.
For eg if
$dir = 'd:/abs/fez';
I know can use the length function to get the length of $dir but how
Here is one way to do it...
The regular expression checks to see if the last character (the one prior to
$) is a slash.
my $dir = 'd:/abs/fez:';
if ( $dir =~ m/\/$/ )
{
print "Ends in a slash\n";
}
else
{
print "No slash\n";
}
-Original Message-
From: [EMAIL PROTECTED] [
> Hi,
>
> How do you extract the last character of a string
Check out substr
> I basically want to see if a list of directory strings have a
> slash at the end
> or not.
>
> For eg if
>
> $dir = 'd:/abs/fez';
>
> I know can use the length function to get the length of $dir but how do I
> ex
Kwabena,
Here is an example of how to pull off the last character of a string and
print it.
You could also store the value returned by the substr function into a
variable...
$dir='d:/abs/fez';
print substr($dir, length($dir)-1) . "\n";
Here is an example of checking the last character of a strin
Hi,
How do you extract the last character of a string
I basically want to see if a list of directory strings have a slash at the end
or not.
For eg if
$dir = 'd:/abs/fez';
I know can use the length function to get the length of $dir but how do I
extract the last character ie. z and then do