while(){ next unless m!^\s*<([^>]+)>([^<]+)!; $h{$1}=$2; } use Data::Dumper; print Dumper \%h; __DATA__ 0 00 APPROVED 100000182165 123456 123456 021112 110544 1234 XXXXXXXXXXXX1111 1.00