Scalar::Util#

Native implementation of Scalar::Util

Provides scalar utility functions (blessed, reftype, etc.)

Synopsis#

use Scalar::Util qw(blessed reftype weaken looks_like_number);

if (blessed $obj) {
    print ref($obj), "\n";
}

my $type = reftype($ref);    # "HASH", "ARRAY", etc.

weaken($ref);                # prevent circular reference leak

if (looks_like_number($str)) {
    print "$str is numeric\n";
}

Perl equivalent: Scalar::Util