Perl usage of split function with varied characters in strings

the strings that I need to regex from is as below:

colour -name red -value 8,0,2 -code 0
colour -name blue -value 9 -code 1
colour -name yellow -value 7,3,2.5 -code 1

The required output is hash of colour name and value

red 8,0,2 blue 9 yellow 7,3,2.5

Piece of code:


my %result = {};
my @word = split ' ', $line ; #$line has each of the line of data that is read from text
$result{$word[2]} = $word[4];

But this is not giving the required output for the values where there are commas.