Perl Regex to strip all but last character in a string

by "Jan Morell" <jan_man(at)bellsouth.net>

 Date:  Thu, 1 Mar 2001 16:27:41 -0500
 To:  <hwg-languages(at)hwg.org>
 References:  co
  todo: View Thread, Original
Hi List Members,

I am trying to strip all but the last digit in a string.  I tried using:
$foo =~ s!^..!!;
which workd fine if there are 3 digits in the string.  (The case most of the
time), but there might only be 2 digits.

Am I going about this backwards?

Thanks for any help.

Jan

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA