in reply to Re: improve performance
in thread improve performance

I updated the codes with your suggestion which is really faster but does not give the same result as the grep. i find @newarray empty where as it is not. did you consider the NOT operator ! in my original code?

Replies are listed 'Best First'.
Re^3: improve performance
by Corion (Patriarch) on Jun 08, 2015 at 10:43 UTC

    No, I did not consider it, but you can consider it in your code.

      event after making the change @newarray is empty.

       if ( $lookup { !$strfile } ) {

        That's not how a hash lookup works. Negating the lookup would be

        if (! $lookup { $strfile } ) {

        If you are struggling with this, most likely your diagnosis of the processing bottleneck warrants reevaluation as well.

        Note that you were already shown the correct code here; please take the time to read all of the replies.