How do I determine the number of elements in an array reference?

后端 未结 4 1993
名媛妹妹
名媛妹妹 2021-02-19 07:26

Here is the situation I am facing...

$perl_scalar = decode_json( encode (\'utf8\',$line));

decode_json returns a reference. I am sure this is a

4条回答
  •  一生所求
    2021-02-19 08:27

    You can also use the last index of the array to calculate the number of elements in the array.

    my $length = $#{$perl_scalar} + 1;
    

提交回复
热议问题