my %extract; while (<>) { /\s(\d+)\|(.*)\Z/ && push @{$extract{$2}}, $1; }