CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Norwegian_Wood] parse tab delimited file and write to new files: Edit Log



FishMonger
Veteran / Moderator

Jun 29, 2013, 1:52 PM


Views: 608
Re: [Norwegian_Wood] parse tab delimited file and write to new files

The format of your source file tells me that the process that generates that file was not thought out very well. Why take it a step further by creating 3000 nearly identical files?

It appears to me that you have an XY problem.

Here's your requested solution.

Code
if ($csv->parse($_)) {  
my ($id, $start, $end, @columns) = $csv->fields();

while (@columns) {
print join("\t", $id, $start, $end, shift @columns), "\n";
}
}


I left out the part that opens/creates each file because you didn't provide enough info regarding how they are to be named. That open statement would be placed inside the while loop.


(This post was edited by FishMonger on Jun 29, 2013, 1:56 PM)


Edit Log:
Post edited by FishMonger (Veteran) on Jun 29, 2013, 1:56 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives