while ($content =~ /(e)(x)(p)r/g) { $hash{$1}={ something=>$2, another=>$3 } }