Auf die Schnelle:
package XD;
use overload '+' => \&myadd;
sub new{
my $self = shift;
my $int = shift;
return bless { JD => $int}, $self;
}
sub myadd{
my($x,$y) = @_;
return($x->{JD} + $y->{JD});
}
package main;
$x = XD->new(11);
$y = XD->new(22);
$z = $x + $y;
print $z; # 33
Jetzt aber Koffer packen....
Hotti Hottentott