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
$num_of_hashes = @{$perl_scalar};
Since you're assigning to a scalar, the dereferenced array is evaluated in a scalar context to the number of elements.
If you need to force scalar context then do as KARASZI says and use the scalar function.
scalar