songahji has asked for the wisdom of the Perl Monks concerning the following question:
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-------------------- 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
Are there other ways to do this better?open IN, "$myfile"; { local $/; $str = <IN>; } close IN; %hash = reverse ($str =~ m/ASCII\=(.*?)\s+Character\=(.*?)\s+/g);
Greets,
Hanny J
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading into a hash from regex
by holli (Abbot) on May 16, 2005 at 20:38 UTC | |
|
Re: Reading into a hash from regex
by jdporter (Paladin) on May 16, 2005 at 20:42 UTC | |
|
Re: Reading into a hash from regex
by TedPride (Priest) on May 16, 2005 at 21:05 UTC | |
|
Re: Reading into a hash from regex
by tlm (Prior) on May 17, 2005 at 00:04 UTC | |
by songahji (Friar) on May 17, 2005 at 13:42 UTC | |
|
Re: Reading into a hash from regex
by strictvars (Sexton) on May 17, 2005 at 19:48 UTC | |
|
Re: Reading into a hash from regex
by Roger (Parson) on May 17, 2005 at 13:23 UTC |