There is a lot of files that's going to be opened a lot of times, so I just want to be sure that this link in the chain is optimal
The thing I'm most concerned with is the best way to put the file in the variable. I do it in a clumsy way today.
open(FILE, "<test.txt");
@myfile = <FILE>;
close(FILE);
foreach $myrow (@myfile)
{
$result .= $myrow;
}
return $result;
I just want to do that in a better way :-) | [reply] [d/l] |
my $text = do {local $/; <FILE>};
Or you can use sysread, but you'll have to benchmark if that's faster.
You also may be able to tweak your filesystem/volumemanager/storagemanager to get a better performance. After all, your road trip gets shorter if you make use of tarmac roads instead of dirt roads. Regardless of the car you use, or your driving skills. | [reply] [d/l] [select] |