Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: extract and export to multiple files

by kiruthika.bkite (Scribe)
on Apr 09, 2010 at 03:55 UTC ( #833692=note: print w/ replies, xml ) Need Help??

in reply to extract and export to multiple files

The problems in your code are, You have opened the file using ,

open (OUT, ">$filename"."$title"."$count") or die "can't open";
But that time the variables $filename,$title,$count are not having any values.

Actually this line should come inside the while loop after getting the title and content from the file.

And you need to close that file immediately after printing the content into that file .

It should be like this,

while (<FILE>) { chomp; ($title, $content) = split("\t"); open (OUT, ">","$title.$count") or die "can't open"; $count++; print OUT "$content"; close OUT; }

Comment on Re: extract and export to multiple files
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://833692]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-07-29 00:47 GMT
Find Nodes?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:

    Results (211 votes), past polls