On 20 December 2012 09:07, Matthew Kerwin <matthew / kerwin.net.au> wrote:

> As it is, the parser is interpreting the ternary operation as the first
> item in the list, like:
>
>     tmp = frac_str.match(/\//) \
>       ? frac_str.match(/(?:(\S+) )*?(\S+)\/(\S+)/).captures \
>       : 0
>     w, n, d = tmp, frac_str, d
>
> Subsequently puts(tmp) is calling Array#to_s which concatenates the
> elements, so you see "134"
>
>
Sorry for replying to myself.  I just noticed that the Perl code also had
an explicit array,

     : ( 1, $frac_str, 0 )

Those brackety thingies are important, no matter which language you're
using.  ;)