in reply to how can you put this?

Sure. What the first bit of code does is use an (anonymous) array ref. What you want to do is use a reference to your array. $graph->set( dclrs => \@colour_array );

Upgrade : Oh well, just go along with tobyink's answer, since it's more complete.