use strict; use warnings; use overload bool => sub{ my $self = shift; $self->{name}; }; use overload "==" => sub{ my $lval = shift; my $rval = shift; #print "Links: $lval, Rechts: $rval\n"; my $lsum = do{ my @h = split //, $lval; my $sum = 0; $sum += unpack "C", $_ for @h; $sum; }; my $rsum = do{ my @h = split //, $rval; my $sum = 0; $sum += unpack "C", $_ for @h; $sum; }; return abs($lsum - $rsum) ? 0 : 1 ; }; my $m = bless{name => 'Erwin'}; if( $m == "Franze" ){ print "Die Namen sind gleich." } else{ print "Die Namen sind unterschiedlich." }