in reply to How to manage a pattern matching & counting with big data file

Can you please check the my code & help me to fix this, so it can run quickly

Not really , the purpose of the program is unclear .... you have included sub get_patterns but it does nothing

It would help if you could explain what problem the program is supposed to solve, and using what steps ... maybe provide short representative sample input ... things like that