while(){ my (@prefix,@rest); chomp; (@prefix[0..2],@rest) = split /,/; for (@rest) { local $, = ','; local $\ = "\n"; print @prefix,$_; } }