I need to take a CSV file read a line, grap the first field (before the first comma, put that field in to a variable, create a file using that variable
Then I use a regx to parse the commas out of the line and write the file.
I did this
open (sitcom, "sitcom.csv") || die "couldn't open the file!";
while ($record = <sitcom>){
$record =~ s/\,//ig;
print $record;
}
close(sitcom);
It returns the rows from the file just fine.
Now I'm trying to read the row in to an array grab the first field and write the file.
open (sitcom, "sitcom.csv") || die "couldn't open the file!";
while ($record = <sitcom>){
@Arry = $record;
$fname = $Arry[0];
open ($fname);
close ($fname);
$record =~ s/\,//ig;
print $fname $record;
}
close(sitcom);
close($fname);
Can someone point me in the right direction, I've been googleing and reading a book but my thick head just isn't gettint there...
Thanks
Sam.