package Customer; sub search_car { my $self = shift; my $factory = shift; my $color = shift; my $car = $factory->search_car($color); return $car; } sub buy_car { my $self = shift; my $car = shift; my $price = $car->price; if (($self->{money} >= $price) and $car->factory->buy($car, $price)) { push @{self->{cars}}, $car; $self->{money} -= $price; } }