in reply to where to look up "funny looking" perl notation (and an example)

  1. As others already pointed out that most likely your $some_var[$i] is an array reference.

    However, just for completeness, I want to point out that it could also be a symblic reference. If use strict is truned off for refs, that would be also correct from a syntax point of view.

    However I am not a supporter of the symbolic ref usage.

  2. It is worth to mention to new perl users, that $# can be used as lvalue.

    This is extreamly useful, when you want perl to garbage collect your big arrays.

    Just do
    @a = (1..1000); print "original array:\n"; print join(",", @a), "\n"; $#a = -1; print "after set to -1:\n"; print join(",", @a), "\n";#You can not say for sure that your array ha +s already been garbage collected at this point, but at least it is no +w a candidator.

Replies are listed 'Best First'.
Re: Re: where to look up "funny looking" perl notation (and an example)
by Hofmator (Curate) on Jan 22, 2003 at 13:18 UTC
    For the sake of garbage collection - if you are 'deleting' the whole array - I prefer the more readable @array = ();

    -- Hofmator