in reply to problem printing array elements -- printing # of lines in array instead

It all goes wrong on your line 46. As you'll see from the documentation, the second argument to split is a scalar value. Therefore your array is evaluated in scalar context and returns the number of elements in the array.

It's also (as always) worth using strict and warnings. In this case, you'll see warnings like "Scalar value @command_array_split[0] better written as $command_array_split[0]".

--

See the Copyright notice on my home node.

Perl training courses

  • Comment on Re: problem printing array elements -- printing # of lines in array instead