Re: [Perl-unix-users] extract the last character or a string

2002-04-11 Thread $Bill Luebkert
[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

[Perl-unix-users] extract the last character or a string

2002-04-11 Thread kwabena . asare
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

RE: [Perl-unix-users] extract the last character or a string

2002-04-11 Thread BWilson
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] [

RE: [Perl-unix-users] extract the last character or a string

2002-04-11 Thread Adam Frielink
> 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

RE: [Perl-unix-users] extract the last character or a string

2002-04-11 Thread david . b . deline
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

[Perl-unix-users] extract the last character or a string

2002-04-11 Thread kwabena . asare
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