overloading(3pm)

πŸ’… NAME πŸ’…

overloading β€” the perl pragma that lets you lexically control overloading πŸŽ€ (this is the overloading(3pm) page from the Perl Programmers Reference Guide, bestie, so you know it's official)


✨ SYNOPSIS ✨

{
    no overloading;
    my $str = "$object"; # doesn't call stringification overload
}

# it's lexical, so this stringifies:
warn "$object";

# it can be enabled per op
no overloading qw("");
warn "$object";

# and also reenabled
use overloading;

okay so like β€” read the comments, they're literally the whole plot 😭 the scope thing matters, the per-op thing matters, and yes you can turn it back on.


πŸ¦‹ DESCRIPTION πŸ¦‹

This pragma is the little switch that lets you lexically disable or enable overloading. That's the vibe. That's the whole job. 🫢

🌸 no overloading

Disables overloading entirely in the current lexical scope. like, the whole thing. gone. nobody's stringifying anything in here ✨

🌸 no overloading @ops

Disables only specific overloads in the current lexical scope πŸ‘‘ so you're picking and choosing which ops get to sit this one out β€” main character energy for the ops you keep, honestly.

🌸 use overloading

Reenables overloading in the current lexical scope πŸ’– the comeback arc we all deserved.

🌸 use overloading @ops

Reenables overloading only for specific ops in the current lexical scope 🌈 so, again, per-op control β€” you don't have to turn everything back on at once, iykyk.

ngl the whole point is that it's lexical β€” the synopsis literally spells it out with # it's lexical, so this stringifies: after the block closes. don't come for me, come for the scope 🫢

πŸŽ€ a lil sign-off πŸŽ€

that's the page, bestie β€” go forth and control your overloading, lexically, per op, iconic behaviour only πŸ’…βœ¨

with love from perl v5.42.3, dated 2026-11-03 β€” overloading(3pm), that's a wrap 🌸

πŸ“¦ where this page comes from