in reply to speeding up script that uses filehandles
Well yes for a start you might strongly consider changing
toforeach my $line (<DATASOURCE>){
as the former has to build a list (thus requiring a large memory allocation) before it can start iterating. The latter will simply read and process the lines of the file one by one.while(my $line = <DATASOURCE>) {
/J\
|
|---|