sub create_treestore { my ($data) = @_; my ($tree_store) = Gtk2::TreeStore->new(qw/Glib::String Glib::String Glib::String/); my $count = 0; foreach my $host (sort keys %{$data}){ my $iter_child = $tree_store->append(undef); my ($dc) = ($host =~ /^(.+?)-/); my $ip = lookup_host_in_hostlistdb($host); my $background = get_background($dc); $tree_store->set($iter_child, 0, $host, 1, $ip, 2, ($count++ % 2 ? $background->[1]:$background->[0]), ); } return $tree_store; }