in reply to Next Line Assigning to A Scalar

What form will the output take? Sounds like you want to store color alternatives. How will you use those alternatives? Will you need to sort them? Can there be more than one black car? Do you need to store the number after the color somewhere?

Your post title talks about assigning to a scalar, but I have trouble imagining that as a useful thing. Perhaps use a hash instead? Put the following right after your print statement (inside the foreach loop):

$price_by_type_and_color{$car}{$color} = $amount;

What kind of vehicles are available?

printf "%s\n",$_ for sort keys %price_by_type_and_color; Output: Bus Car Truck

Updates: minor typos and omissions fixed

1 Peter 4:10

Replies are listed 'Best First'.
Re^2: Next Line Assigning to A Scalar
by rmwheeler (Initiate) on Oct 30, 2014 at 13:08 UTC
    Thanks so much for the assistance. I guess this is the best way of explaining it since I have no output.
    Variables ========= $type $color $amount -> for 1st line $type $color1 $amount1 -> for 2nd line if $type matches the 1st line $ +type $type $color2 $amount2 - for 3rd line if $type matches the 2nd $type