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

1. $last = substr $foo, -1, 1;
2. ($last) = $foo =~ /(.?)$/;

--perlplexer
  • Comment on Re: How do I capture the last character in a string?