david wrote:
Andrew Gaffney wrote:


I've got an array reference and I'm trying to figure out how many elements
are in it. I've tried '$#arrayref', '[EMAIL PROTECTED]', '$(@($arrayref))', and
probably a few others that I've forgotten. What is the correct way to do
this?


you can try @{EXP} or $#{EXP}+1 where EXP is your array reference:

[panda]# perl -le 'print $#{[1,3,5,7]}+1'
4
[panda]# perl -le 'print @{[1,3,5,7]}+0'
4
[panda]#

the '{}' is sometimes optional depends on EXP, i usually use it for personal perference.

'$#{$arrayref}+1' worked for me. Thanks. Once again, I don't know what I'd do without the people on this list.


--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to