in reply to Re: How do I capture the last character in a string?
in thread How do I capture the last character in a string?

Just for the sake of completeness, I wanted to make sure you didn't also forget about 'chomp' - here's the 1st few lines of 'perldoc -f chomp':
chomp VARIABLE chomp( LIST ) chomp This safer version of "chop" removes any trailing strin +g that corresponds to the current value of $/ (also known as $INPUT_RECORD_SEPARATOR in the "English" module). It r +eturns the total number of characters removed from all its arg +uments. It’s often used to remove the newline from the end of a +n input record when you’re worried that the final record may be + missing its newline. When in paragraph mode ("$/ = """), it re +moves all trailing newlines from the string. When in slurp m +ode ("$/ = undef") or fixed-length record mode ($/ is a referenc +e to an integer or the like, see perlvar) chomp() won’t remove +any- thing. If VARIABLE is omitted, it chomps $_. Example: while (<>) { chomp; # avoid \n on last field @array = split(/:/); # ... }
HTH.