Thread Rückgabewerte Funktion addieren
(6 answers)
Opened by ruco at 2013-08-12 13:18
Prinzipiell kann man sowas sogar baun, aber ich glaub man will es nicht ;)
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 { package Voodoo; sub FETCH { my $self = shift; return $self->{'a'}; } sub STORE { my $self = shift; my $val = shift; $self->{'a'} += $val; } sub TIESCALAR { my $self = {}; my $class = shift; bless $self, $class; return $self; } } my $a; tie $a, 'Voodoo'; $a = 4; $a = 2; $a = 9; say $a; 1 + 1 = 10
|