in reply to search a large text file

No need to sort, given your description of the problem.

my @found; while( <file> ) { next unless m/text2/; # Reject disqualified lines quickly. m/\s+(\d+)/ or die "Unexpected data format at file line $.\n"; push @found, $1; }

Dave

Replies are listed 'Best First'.
Re^2: search a large text file
by perl_lover_always (Acolyte) on Feb 08, 2011 at 13:03 UTC
    since my file is big and my searches are often and numerous, searching with this method over a large file is very slow.