On Jul 26, 2007, at 8:15 PM, Al Cholic wrote:

> I have an array that has elements that are arrays.
>
> It looks like this(I'll call it array), it has:
> [
> [POS1, POS2a\, POS2b, POS3, POS4],          # this array is in  
> position array[0]
> [POS2c\, POS2d\, POS2e],                    # this array is in  
> position array[1]
> [POS2f\, POS2g\, POS2h],                    # this array is in  
> position array[2]
> [POS1, POS2a\, POS2b, POS3, POS4]           # this array is in  
> position array[3]
> ]
>
> Notice that Im trying to escape the commas with the backslash in the
> array.  Is this the proper ways to escape commas in arrays?  The  
> POS2's
> are separated with commas(not to confuse them with the commas that
> separate the array elements).

If you are showing here is intended to be Ruby code, it is simply bad  
syntax. AFAIK, backslashes have no escape function outside of strings  
[*] and regular expressions. Also, as written, those POS thingies are  
going to be treated as identifiers naming references to constant  
objects. Is that what you intended? Then your sub-arrays should be  
written something like

    [POS1, [POS2a, POS2b], POS3, POS4]
    [nil, [POS2c, POS2d, POS2e], nil, nil]

and so forth.

On the hand, if what you are showing is intended to represent data  
stored as text in a file, I think you would be better off with a  
different data format. Look at YAML or CSV. There are libraries for  
handling those well-established formats.

Regards, Morton

[*] I'm lumping back-tick expressions with strings here.