in reply to Xls reader
Two things I see right off the bat: First, you've got nested loops (for(my $m=0; $m<$length; $m++) { for(my $l=2; $l<2990; $l++) { ...) for a simple string equality search, where the outer loop could be removed and replaced by a much faster hash lookup. Second, inside the loop, you're making a ton of OLE calls with $Sheet2->Cells($l,$Signalcolumn)->{'Value'} - it'd be better if you cache this in a local variable. Something like this (untested):
my %longNames = map { ($_=>1) } @longNames; for my $l (2..2990) { my $v = $Sheet2->Cells($l, $Signalcolumn)->{'Value'}; next unless length $v; if ( $longNames{$v} ) { $Sheet2->Cells($l, 100)->{'Value'} = "matched"; print"\n***********Matched*************\n"; } }
Update: Now tested, and I can confirm it runs much faster. Note that you really should Use strict and warnings, you've got a couple of undeclared variables like $startingrow.
|
|---|