in reply to Faster Flat File
The storage of data within a list structure, such as a flat-text file, means that all subsequent data searches will take O(n), that is, the time taken to search the dataset will scale linearly with the growing size of the dataset. Alternatively, if you were to migrate your data storage to a DBM or serialised hash structure, your subsequent lookup times would be O(1), that is, a constant time, irrelevant of the size of your dataset (eg. a lot faster).
Also too, the migration of your dataset to a hash structure would allow for the establishment of more complex data structures than currently allowable - For example, what happens currently when your data contains a | character?
Update - Also too, you could make use of Tie::Hash::Approx written by OeufMayo in place of your $s =~ /$d/g match if you index your hash by the value in the variable $d (assuming it is unique).
perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'
|
|---|