in reply to Re^2: Working with Arrays
in thread Working with Arrays

this is not suitbable, as the file could be 1000 lines long

1000 lines is not all that long. This should be plenty small enough to load into memory, as long as you're not on a very limited system. As a test, you can try loading up hashes with different numbers of elements, and looking to see what the memory usage is:

perl -e 'my %hash = map {$_=>$_} 1 .. 1_000; print "done"; sleep' perl -e 'my %hash = map {$_=>$_} 1 .. 10_000; print "done"; sleep' perl -e 'my %hash = map {$_=>$_} 1 .. 100_000; print "done"; sleep'

On my system, the version that loaded 100,000 numbers used 21mb of memory. The version that loaded 1,000 numbers only used 3mb. On any modern computer, this should be a reasonable amount.