use strict; use warnings; { package Test1; sub new { return bless {}, shift; } } { package Test2; sub new { return bless {}, shift; } use overload '""' => sub{ return 'blah'; }, fallback => 1; } my $t1 = Test1->new(); print $t1 . "\n"; my $t2 = Test2->new(); print $t2 . "\n";