in reply to Count of element in array - Help

TL;DR, sorry

And I don't know if it'll fix your problem ...

... but what's catching my eye is code like

    $arr[$arrcnt][0] = "First",            $arr[$arrcnt][1] = 8, $arr[$arrcnt][2] = 1, $arr[$arrcnt][3] = 27, $arrcnt++, if ($SWOS ==10);

Using the scalar comma operator do separate many expressions means asking for trouble with precedence ( did you even spot the comma before the if )?

Use semicolon as separator and a good old

if ($SWOS ==10) { ... }

For god's sake just write something like

@arr = ( ["First", 8, 1, 27], ["5x First",... ], ... #etc );

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery