use strict; use warnings; $/="--------------------"; my %h = (); open IN, "<", "c:/pm217.txt" or die $!; while () { if ( /ASCII=(.+?)\nCharacter=(.+?)\n/ms ) { $h{$2} = $1; } } close IN;