in reply to Is there a way to find the size of a data structure?

You could use Storable, just freeze the structure in memory and print its length, i.e.
use Storable; my %a = ( 'a' => 'something..', 'b' => 'something else..', ) print length(Storable::freeze(\%a))."\n";
This will give you a "rough ball-park sizeof" without the memory overhead of using a module like Devel::Size :-)

Replies are listed 'Best First'.
Re^2: Is there a way to find the size of a data structure?
by dakkar (Hermit) on May 16, 2005 at 19:19 UTC

    Well, that would give the size of the Storable image of the data, not the live-in-RAM size... and I think the OP intended the latter.

    So, for the OP: use Devel::Size, or study the sources...

    -- 
            dakkar - Mobilis in mobile
    

    Most of my code is tested...

    Perl is strongly typed, it just has very few types (Dan)