Phil Plumbo wrote:
> 
> I ran across a curiosity in a perl program today, which can be explained
> like so:
> 
>  @ITEMS = (0, 1, 2);
>  print @#ITEMS;                # prints "2";
> 
> So if you wedge a '#' into an array name, it means "the length of the array,
> less 1" (Oh, of course!). The guy was using it as a loop limit.
> 
> I couldn't find anything on this in any of the perl books I own... is this a
> documented feature of the language, or just a fetid schbat of boogage?
> 
> To me, it looks suspiciously like a fetid schbat of boogage.

It is actually documented in the Programming Perl 1st ed on page 68. You
can also change the length of an array by assigning a value to
$@whatever.

Shortening the length does not actually destroy any data. You can
lengthen it again to get the data back. Pretty cool stuff.

-- 
Collective Technologies   | Clay Fandre, cfandre at colltech.com
   A Pencom Company       | Cell : (612) 719-4179
http://www.colltech.com   | Pager: 6127194179 at airtouch.net

---------------------------------------------------------------------
To unsubscribe, e-mail: tclug-list-unsubscribe at mn-linux.org
For additional commands, e-mail: tclug-list-help at mn-linux.org