# Your SQL here. while (my ($timestamp, $field1, $field2, $field3)=$sth->fetchrow_array() { push @timeline, $timestamp; push @data1, $field1; push @data2, $field2; push @data3, $field3; }