while () { if (/,/) { process_data(@data); @data = split /,/, $_; } else { $data[$#data] .= $_; } }