Lets say I have a file containing
--------------------
ASCII=i
Character=i
Decimal=970
Hexidecimal=3CA
Entity name=
Decription=i with an umlaut
--------------------
ASCII='
Character='
Decimal=39
Hexidecimal=27
Entity name=
Decription=quote
---------------------
ASCII=<
Character=<
Decimal=60
Hexidecimal=3C
Entity name=lt
Decription=less than
--------------------
.... truncated
Next, a hash need to be populated with the value of 'ASCII' and value of 'Character'. Since the value of 'Character' are unique, it will be the hash key.
So far this is what I came up
open IN, "$myfile";
{
local $/;
$str = <IN>;
}
close IN;
%hash = reverse ($str =~ m/ASCII\=(.*?)\s+Character\=(.*?)\s+/g);
Are there other ways to do this better?
Greets,
Hanny J