http://www.perlmonks.org?node_id=977370

This is a slightly silly thing that I've recently been surprised to discover actually works...

{ package String; use base 'CORE'; use overload q[bool] => '_deref', q[""] => '_deref', q[0+] => '_deref', fallback => 1, ; sub new { my ($class, $str) = @_; bless \$str => $class; } sub _deref { ${$_[0]}; } } my $greeting = String->new("Hello World\n"); print $greeting->substr(6);

It's not really obfuscated, but even experienced Perl programmers would probably do a double-take when seeing it, and I couldn't think of a better section to put it in.

By the way, you can also use CORE directly - the subclassing is not strictly necessary.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'