($class, $x, $y) = @_; my $ref = \(my $anon) + 0; $x_fields{$ref} = $x; $y_fields{$ref} = $y; bless $ref, $class; } sub x { my $self = shift; $x_fields{$$self + 0}; # インスタンス変数 } sub DESTROY { my $self = shift; my $ref = $$self + 0; delete $x_fields{$ref}; delete $y_fields{$ref}; } 19 / 23