in reply to Detecting whether forward slash is present in string
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
|
---|