Just like the vast majority of my programs start with
use strict and
use warnings, I tend to have a collection of standard extensions
that I nearly always end up bringing in. In addition to those modules
that I've mentioned in previous advent calendar days (Carp,
File::Spec, Cwd, Data::Dumper) I always end up seem to bring in
The function that I tend to use most in Scalar::Util is
It's yet another one of those functions that I could probably write
myself. But why always reinvent the wheel? By bringing in
it's simpler, makes my code easier to read, and avoids me having to
worry about annoying bugs and typos.
Another functionality in Scalar::Util that's really important is the weak referencing system. Since Perl currently uses a reference count garbage collector you can get yourself in an awful mess with circular referencing, and end up eating vast sums of memory - which is bad, M'kay. And here's a way out that's simple and straightforward, and again in a way where I don't have to worry about the details.
Wonderful. Extensions to perl like this remind me why I love the resilience and adaptiveness of Perl.