I Have stored a decoded json in an array. I need to know the array size in bytes, so that I can parse it. Please suggest me a way to know the size of an array in perl.
Note: It is not the number of elements in array. I want size in bytes or mb
From this example
use strict;
use warnings;
use Devel::Size qw(total_size);
my @arr = (1, 2, 3, "Foo", "Bar", "Baz", [4, 5, 6], {xyz => 2048});
print "Size: ", total_size(\@arr), " bytes.\n";
You would therefore need Devel::Size
If you are unsure on how to install modules from CPAN, go to this link