Dear Perl Monks,
I have a very long tab separated list that looks something like this:
Apples__0.5__-10__Emma:17:15:14:18__Peter:2:7:4:1(Newline)
Pears__0.7__-12__Alex:101:144:110:111(Newline)
Oranges__0.8__-14__Shan:12:14:9:57__Heena:65:17:15:24 __Rachel:1:5:18:54(Newline)
The double underspaces represent tabs. Sorry if that comes out poorly here.
The point is that each line will have a variable amount of columns because the data from columns 3
2 onwards is variable.
I am trying to parse the list so each column after 3 has its own entry, but retaining the information that went beforehand for example:
Apples__0.5__-10__Emma:17:15:14:18(Newline)
Apples__0.5__-10__Peter:2:7:4:1(Newline)
Pears__0.7__-12__Alex:101:144:110:111(Newline)
Oranges__0.8__-14__Shan:12:14:9:57(Newline)
Oranges__0.8__-14__Heena:65:17:15:24(Newline)
Oranges__0.8__-14__Rachel:1:5:18:54(Newline)
I hope I have explained this clearly.
I tihnk this should be easy in perl but as a new perl user I am finding it difficult. My experiende is ,imited to fiddling with other already existing scripts, not writing them from scratch. (I have started doing this in excel manually but it's extremely tedious and the file is huge.)
Any help will be much appreciated.