my %attrs = ( foo => 1, bar => 2, ..., baz => 50, ); while (my ($attr, $val) = each %attrs) { $obj->set_value($attr => $val); }