in reply to Re: Re: My scalars swell
in thread My scalars swell

While the space usage by Perl may astound you, when you start accounting for it, it turns out to be much more reasonable than you might think. For instance a basic scalar value has to have a pointer to a data structure, keep a reference count, and keep a bunch of flags to know what it currently is. That is 12 bytes of overhead for general behaviour related metadata, and we don't even have the data yet! Plus the things you are discounting, arrays and hashes and things, are all non-trivial data structures which involve lots of associated metadata, and then wasted space for internal buffering.

For more on this, you should take a look at Perl 5 Internals by Simon Cozens. And after that, dive into perlguts.

Perl isn't C. But the nice features don't come for free.