print "\tProcessing data...\n"; foreach (@links) { my $link = $_; # Get data from the internet my $httpReply = $browser->get($link); ####### This is my problem, the regex match eats up a lot of RAM. my @data = $httpReply->content =~ /regex/g; undef($httpReply); #Frees memory round the size of the webpage. #undef(@data); #Frees memory around the size of the array. ####### ####### If the RAM is nearly full, I am unable to completely store the values in a hash. # Add each extracted data to the hash while(scalar @data) { my $line = shift(@data); my ($field1, $field2) = split(':', lc($line)); # Sort the emails into a hash of arrays. key = domain; value = [username, reference] push(@{$emailHash{$field2}} , [$field1, $link]); } }