foreach my $row (@sensor_h) { push(@draw, { file => "../data/$row.rrd", legend => "Source 1", thickness => 2, color => '00FF00' }); } #### $rrd->graph( #image => '-', image => "../images/" . $sensor . ".png", vertical_label => 'Sensors', width => $width, height => $height, start => time() - $period, draw => { file => "../data/sensor1.rrd", legend => "Source 1", thickness => 2, color => '00FF00' }, draw => $draw[0], draw => $draw[1], ... and so on ... );