APM: arrays and hashes
ezra pagel
ezra at jdba.org
Tue Sep 21 13:18:13 CDT 2004
Brian Michalk wrote:
>I'm having problems making a hash reference to a 2D array.
>
>
Sorry, no such thing ;)
>I would like to get the following output:
>
> DB<40> x @res
>0 'hello'
>1 'there'
>2 'world'
>
> DB<45> x $self->{'ary'}
>0 ARRAY(0x8cfd1f0)
> 0 'hello'
> 1 'there'
> 2 'world'
>1 ARRAY(0x8cf2ab0)
> 0 'hello'
> 1 'there'
> 2 'world'
>2 ARRAY(0x8cd385c)
> 0 'hello'
> 1 'there'
> 2 'world'
>
>One would think one could get it like this:
> DB<43> push @{$self->{'ary'}}, [@res]
> DB<43> push @{$self->{'ary'}}, [@res]
> DB<43> push @{$self->{'ary'}}, [@res]
>
>
>However, the above generates the following:
> DB<52> x $self->{'ary'}
>0 ARRAY(0x8cfc4e8)
> 0 ARRAY(0x8cfc494)
> 0 'hello'
> 1 'there'
> 2 'world'
> 1 ARRAY(0x8cfce30)
> 0 'hello'
> 1 'there'
> 2 'world'
> 2 ARRAY(0x8cfd0d0)
> 0 'hello'
> 1 'there'
> 2 'world'
>
>Which is a 3D array, and I can't figure out how to get it to work correctly.
>_______________________________________________
>Austin mailing list
>Austin at mail.pm.org
>http://mail.pm.org/mailman/listinfo/austin
>
>
Actually, that's still just a 2D array; I think that the debugger lines
are throwing you off. Try x $self->{'ary'}->[0][0]
More information about the Austin
mailing list