Would it be possible to, instead of describing a problem, actually demonstrate the code you're having trouble with? Not all 1000 lines, mind you. Create a 20-line (or less) snippet that isolates and illustrates your question. I'm starting to see what you're asking, but when you start saying things like "i also don't know how i can accept a filehandle in the script", that could have several meanings.
| [reply] |
hey,
heres some code...
MyMopule.pm
....
....
copyFile
{
...
...
return aFilehandle
}
1;
script.pl
use MyModule;
my $FILE = MyModule::copyfile;
$file is a handle to the file i'm copying how do i save it?
thanks
| [reply] |
You've got me. I have no idea, since you didn't post anything close to resembling code. I cannot guess what MyModule.pm contains, and I cannot guess how it works. You cannot just save a filehandle; I can tell you that much. A filehandle is a sort of link to a file or data stream that has been opened, either for input, for output, for append, or one of several other operations. If you've been handed a filehandle, my guess is that you would first open an output filehandle too, and then from the filehandle you've been handed by MyModule you would start reading from it using the diamond operator. Then as you read each line from it, you would start writing each line to your output filehandle.
You haven't posted any code to help me give you additional guidance, and thus, I don't have any context for which I would be able to provide any code examples either. Sorry. Try perlopentut and open for starters.
| [reply] |