I have a string of comma delimited numbers and I want to replace the last comma with ' and '.
I can write a regexp to find the last instance of ', ', but I haven't been able to figure out how to replace just that. It drops the last order number from the string
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!
I can write a regexp to find the last instance of ', ', but I haven't been able to figure out how to replace just that. It drops the last order number from the string
Code:
$ord_list = '12345678, 23456789, 34567890, 98745632';
$ord_list =~ s/(, )\d+$/ and /;
result: $ord_list = '12345678, 23456789, 34567890 and '
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!