Sep 1, 2015, 6:02 AM
Post #1 of 3
dear perl gurus,
would like to consult on below.
say i have string below:
abcd efgh 1 (single space before digit)
ijkl mnop 2 (double space before digit)
what im trying to do is to remove the spaces & digit at the end.
I have below code but it only works for to take away 1 space for the second string above (1 space remains at the end). Is there a 1-liner to cater for both?
(my $new= $orig) =~ s/\ \d.*//;