On Wed, Nov 14, 2012 at 11:05 AM, jet speed <speedj...@googlemail.com>wrote:

>
> file.txt
> ----------------
>
> 22:5a => 10.00.00.00.aa.56.9b.7a
> 32:9c => 10.00.00.00.aa.46.9b.33
> a2:cc=> 10.00.00.00.aa.5a.9b.63



Er, read it in, line by line, chomp, split on something like
my ($key, $value) = split(/\s*=>\s*/);

and build a hash (don't use "hash" (or, probably, "key" and "value" ;-) as
a variable name, please).  The "\s*" are because your data shows
inconsistent white space.

You could slurp the whole thing in, subs commas for new lines and eval it
into a hash, as you've got the super-comma "=>" already there and probably
other tricks but ...

Just remember to treat both your key and values as strings as the numeric
prefix to them could make for surprises - that is
22:5a == 22:9c  is true
22:5a eq  22:9c  is false



-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

Reply via email to