SPUG: scalar(@array)

Dan Ebert mathin at mathin.com
Thu Apr 13 16:33:13 CDT 2000


What does this function do exactly?

I though that it would give the number of elements in an array, but ...

I have some code that creates a nested array:

$record[101][0] = $var1a;
$record[101][1] = $var1b

$record[102][0] = $var2a;
$record[102][1] = $var2b;

etc...

$record[322][0] = $var322a;
$record[322][1] = $var322b;

When I do a "scalar(@record)" it gives me 323 ... when I expected to get 221
(322 minus 101).  It is OK, because my goal was to arrive at the value that
'scalar(@record)' returned anyway, but it wasn't what I expected.

Dan Ebert



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace "action" below by subscribe or unsubscribe
           Email to majordomo at pm.org: "action" spug-list your_address





More information about the spug-list mailing list