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
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.