Good ol' substitution regex:
# if ( substr( $string1, -1, 1 ) eq "/" ) # check for trailing slash. if ( $string1 =~ s|/\s*$|/| ) # even better { $string2 =~ s|^/||; # remove leading slash if it's present. }
Update: Added additional code to satisfy problem requirements more fully.
Zenon Zabinski | zdog | zdog@perlmonk.org
In reply to Re: Detecting whether forward slash is present in string
by zdog
in thread Detecting whether forward slash is present in string
by philuk86zen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |