# You could load the hash from a database table, or just call the database for # each car. I'm just hardcoding for this example: my %car_models = ( Corolla => { drive=>'fwd', body=>'hatch', engine_capacity=>1798 }, Tercel => { drive=>'fwd', ... } ); while () { chomp; my $car = Car->new(); my $model_attributes = $car_models{$_}; $car->drive_type($model_attributes->{drive}); $car->body_type($model_attributes->{body}); $car->engine_cap($model_attributes->{engine_capacity}); ... }