in reply to Does @{ } copy arrays?
Something I figured out recently is that you can dereference an array ref with $#{} to get the index of the last element. An empty array has it's "last element" at -1, so try this:
if ( $#{ $complete->{landmarks}->{LOG}->[$i][$j][$p] } >= 0 ) { #Whatever }
Update: While that will fix your issue, it doesn't answer the question you asked in the subject. Hopefully someone can answer that authoritatively, but I'll go out on a limb and say that dereferencing shouldn't make a copy of the array. It should tell the interpreter, "There is an array at the end of this pointer." Then the interpreter says, "Thanks, I'll just use that in scalar context now", which should be just fine.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Does @{ } copy arrays?
by dave_the_m (Monsignor) on Oct 16, 2009 at 21:45 UTC | |
by BrowserUk (Patriarch) on Oct 16, 2009 at 21:57 UTC | |
by dave_the_m (Monsignor) on Oct 17, 2009 at 10:50 UTC | |
by BrowserUk (Patriarch) on Oct 17, 2009 at 15:41 UTC | |
by LanX (Saint) on Oct 17, 2009 at 19:28 UTC | |
| |
by QM (Parson) on Oct 17, 2009 at 01:06 UTC | |
by dave_the_m (Monsignor) on Oct 17, 2009 at 10:57 UTC | |
by QM (Parson) on Oct 17, 2009 at 19:57 UTC | |
by ikegami (Patriarch) on Oct 28, 2009 at 18:00 UTC | |
by bv (Friar) on Oct 17, 2009 at 16:34 UTC | |
by ikegami (Patriarch) on Oct 23, 2009 at 20:57 UTC | |
by Anonymous Monk on Oct 17, 2009 at 18:09 UTC |