in reply to Script far too slow with large files - wisdom needed!

The simplest way to speed up your second loop would be to skip over all the non-title lines:

my( $ti, $rt ); { { local $/ = "TITLE="; <MGF>; } ( $ti ) = <MGF> =~ m[^(\S+)]; { local $/ = "RTINSECONDS="; <MGF> } ( $rt ) = <MGF> =~ m[^(\S+)]; if( exists $IDS{ $ti } ) { $IDrtPairs{ $ti } = $rt; } redo unless eof( MGF ); }

Warning untested code that probably needs a couple of tweaks, but should explain the idea.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.