http://www.perlmonks.org?node_id=886929

perl_lover_always has asked for the wisdom of the Perl Monks concerning the following question:

dear Monks I have a very large text file (~5g) and I need to search each time for a string in the first column and retrieve the second column of the line. Eg:
text1 9 text2 2 text3 1 text2 3
I want to search for 'text2' and retrieve 2 and 3, possibly in the form of an array. I tried to sort my file and use file::seek or search::dict modules but the sorting process takes ages and I'm running out of time! any suggestion would be appreciated to handle this problem.