[thelist] Count array locations in perl

Anthony Baratta Anthony at Baratta.com
Tue Feb 13 22:07:17 CST 2001


At 10:15 PM 2/13/2001 -0500, you wrote:
>@foo in a scalar context will return the number of items in an array.

With perl there are a zillion ways to do things:

I use $#foo+1

as the great Larry Wall wrote....

         scalar(@foo) == $#foo+1;

         "is always true."






---
Anthony Baratta
President
Keyboard Jockeys





More information about the thelist mailing list