[ale] perl question

michael d. ivey ivey at gweezlebur.com
Tue Apr 27 14:13:14 EDT 2004


On Tue, Apr 27, 2004 at 01:44:20PM -0400, Chris Fowler wrote:
>   #
>   # I need to determine the number of objects
>   # in the array so I can append to it.
>   #

Well, that's not really true.  push and unshift will add things to an
array without knowing the length.  splice and -1 indexing could also do
it.

However, '$length = scalar @array' gives you the number of elements, and
$#array gives you the number - 1.

Does that help?

-- 
michael d. ivey        [McQ] : "A mathematician is a blind man in a
   <ivey at gweezlebur.com>     : dark room looking for a black cat which
http://gweezlebur.com/~ivey/ : isn't there."
 encrypted email preferred   :                        -- Charles Darwin



More information about the Ale mailing list