Thanks, it works great.

I used the regex in the end, the list will only ever be a few elements long (and the 
script doesn't need to be efficient). Can't say I understand it completely though (I 
was with you up until the first comma) :)

Apologies for my mail client. It's a web-based dohickey that seems to work quite 
terribly. Most of my mails are inexplicably 'centered' and the dates are usually crazy 
(people tell me they've got mails from me dated as 1969!). It's a perl script, but 
I've not got access to the server to fix it or install a better one. Bare with me for 
now!


Tristan


You Wrote:
----------

[What mail client are you using?  It refuses to include a Date: header]

On , [EMAIL PROTECTED] said:

>apples, oranges, pears
>
>I'd like to make it reads:
>
>apples, oranges, or pears

No need to use a regex, especially since a regex will have to go through
the whole string.

  # if there is a comma, get the last one
  if (($last_comma = rindex($string, ",")) != -1) {
    # replace it with ", or"
    substr($string, $last_comma, 1, ", or");
  }

The regex to do that would be

  s/,(?=[^,]*$)/, or/;

Maybe you'd like to use the regex approach, though.



_______________________________________________________
sent via the murky.net webmail hegemony

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to