Rod Adams wrote:
Austin Hastings wrote:
--- Rod Adams <[EMAIL PROTECTED]> wrote:
TSa (Thomas Sandlaß) wrote:

@m = [[1,2],[3,4]]

@m[0;1] is a multidim deref, referencing the 4.

Referencing the 2, I hope?

Doh!

Yes, the 2.

Really?

@m here has _single_ array-ref so
@m[0] returns that single array-ref - [[1,2],[3,4]]
@m[0;1] then returns array-ref [3,4]
@m[0;0] would return [1,2]
@m[0;0;1] would return 2

Double-checking with pugs: (multi-dim with ; doesn't work yet)

    pugs> my @m = [[1,2],[3,4]]
    ({ref:<Array>})
    pugs> @m[0]
    ({ref:<Array>}, {ref:<Array>})
    pugs> @m[0][1]
    (3, 4)
    pugs> @m[0][0]
    (1, 2)
    pugs> @m[0][0][1]
    2

@m = [[1,2],[3,4]] IS NOT same as @m = ([1,2],[3,4])

    pugs> my @m = ([1,2],[3,4])
    ({ref:<Array>}, {ref:<Array>})
    pugs> @m[0]
    (1, 2)
    pugs> @m[0][1]
    2

--
Markus Laire

Reply via email to