|
Hi,
I have a problem.
I need to open unknown number of files for writing.
In order to solve the problem I tried to open files in an array,
where each node in the array is a pointer to a file.
I succeed in opening the files and close all the files,
but I can't write to them.
Please help me!
Thanks,
Rotem.
This is the code:
-----------------------------------
open the files (works):
----------------------------------
while ($currFile < $totalFiles)
{
# open data file
open($dataFilesList[$currFile], ">$currFile");
$currFile++;
}
--------------------------------------------------
write to the files (doesn't work):
--------------------------------------------------
while ($currFile < $totalFiles)
{
print $dataFilesList[$currFile] ("bla bla");
$currFile++;
}
This is the error:
Not a CODE reference at ./script.pl line 263, <INPUT_FILE> line 1
------------------------------------
close the files (works):
------------------------------------
while ($currFile < $totalFiles)
{
# close data file
close($dataFilesList[$currFile])
$currFile++;
}
|