%ids; #loop through lines #add id to the list $ids{$my_input_id} = 'id'; #end loop @ids = values %ids join(',' @ids);