in reply to How can i print to my outfile handle?

As the Previous reply put it so succinctly.

"True laziness is hard work "

I'm going to copy my post to the previous question in the hopes that it might help you. My guess is you are over thinking the problem.

QUESTION: Hello everyone. I need some help with creating and writing to a new file.

I have a text file in the following format: sku, itemname, itemdescription, price

I want to read each line, then write the contents of the line to a new file that is named sku.html

So for the following example source file: 123, soap, dove, $1.99 I want to save that line to a file named 123.html

I have the basics of how to open and read a file, and how to write to a new file. I just can't figure out how to name the new files dynamically after the sku field. Any suggestions are greatly appreciated. Thanks!

My post:

It's

$chunklookup = "Datafile.txt"; open(DGRAB, $chunklookup) || die ("Could not open $chunklookup (DATA T +O GRAB) \n"); while (<DGRAB>) {push(@datain, $_)};close DGRAB; foreach @datain {$currentline =$_; @linesplitfetch = split(/,/, $currentline); open (MYFILE6, '>@linesplitfetch[0].html')|| die ("Could not open @lin +esplitfetch[0].html \n"); print MYFILE6 "Durka Durka Durka $currentline here ";close(MYFILE6); } # foreach @datain

Go Team America!