Found the following in the perl 'split' documentation:

>  If the PATTERN contains parentheses, additional array elements are
> created from each matching substring in the delimiter.
>
>    split(/([,-])/, "1-10,20", 3);
>
> produces the list value
>
>    (1, '-', 10, ',', 20)
>
> If you had the entire header of a normal Unix email message in C<$header>,
> you could split it up into fields and their values this way:
>
>    $header =~ s/\n\s+/ /g;  # fix continuation lines
>    %hdrs   =  (UNIX_FROM => split /^(\S*?):\s*/m, $header);

Surprisingly enough, this *did* work in Ruby too

> irb(main):001:0> "1-10,20".split(/([,-])/)
> ["1", "-", "10", ",", "20"]

but is not in the String#split documentation. (This also neatly solves
my previous problem, splitting a string into delimited substrings).

This is from the ruby 1.6.3 package - don't know if the documentation
has been fixed in the 1.7 branch.

-- 
Martin DeMello