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


in reply to Extracting Data from .txt file

Like this:

use warnings; use strict; my %hash_val; while (<>) { while (/\b([[:alpha:]]{3}).+?\(.+?(\d+?)\)/gs) { $hash_val{$1} = $2; } } print $_,'=',$hash_val{$_},$/ foreach keys %hash_val;