On box A I'm running: perl, v5.8.8 built for x86_64-linux-thread-multi
On box B I'm running: perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Running perl -cw on box boxes says the script is clean and "use strict" is in play. After executing the script, I receive "Can't use string ("1") as an ARRAY ref while "strict refs" in use" on box B which wasn't happening on box A.
Looking through the perl changelog, I still cannot find what has changed that would cause this.
The issue is in the way that I've referenced array objects in a for loop:I cannot for the life of me remember why I decided to referenc the array that way to get the index length, but I do know there was a change in the changelog that did away with $# and I'm wondering if this fell victim to that change. The solution is obviously changing the for loop to:for (my $i=0; $i <= $#{@alarms}; $i++) { print $alarms[$i]; }
Can anyone tell me what the difference between the array name front loaded by dollar-pound and encapsulated by curly braces than just dollar-pound-arrayname and why it no longer works?for (my $i=0; $i <= $#alarms; $i++) { print $alarms[$i]; }
In reply to understanding curly braces surrounding an array by kionysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |