|We don't bite newbies here... much|
[SOLVED] Get element count of CONSTANT list (aref))by stevieb (Abbot)
|on Mar 12, 2018 at 21:29 UTC||Need Help??|
stevieb has asked for the
wisdom of the Perl Monks concerning the following question:
Hello friends and esteemed Monks,
This isn't a problem per-se, just something I've observed and am wondering if there's a way around it.
I am currently building several wildlife cameras that will be attached to my house and some of my cabins, each camera will be attached to a Raspberry Pi, and will stream back results to a central preview server that I will display on a television screen (up to eight inside of a single browser window).
To enhance what I've already got working, I decided that I want pan/tilt capabilities to my cameras, so for the tilt, I'm using a servo (with the servo() capability of RPi::WiringPi), and for the pan, I'm going to use a stepper motor with a ULN2003 integrated circuit, for which I'm now writing a new distribution, RPi::StepperMotor for. Everything is working great thus far, but I have a question specifically related to constant.
Normally, with a list (ie. array in this case), we can get the count of elements and assign it elsewhere:
However, in the module I'm writing, I'd prefer to use a constant:
All is still well and great. However, what I can't seem to figure out, is how to extract the count of elements in the constant list. Here is an example. It prints only aref ok. I've tried a few things I've found in the documentation and elsewhere, but I've either overlooked something, or it's not possible to extract the info I want here:
I have tried:
Is it that I'm oblivious to something, or is what I'm attempting not possible?