in reply to Re^2: grep unique values , remove the blank spaces and store it in a variable
in thread grep unique values , remove the blank spaces and store it in a variable

Hello if you want to filter out, let's say, keys that does not starts whit number, you can change
my %hash = map { $_, 1 } @array;
with
my %hash = map { $_, 1 } grep {$_=~/^\d/} @array;

Anyway if i understand it must be only one key like this. maybe better you use Data::Dump's dd to inspect the array.

Also some garbage can come from (deprecated) XML::Simple. Try to switch to something usable like XML::Twig.

UPDATE: obviously the sage Athanasius is right here below, code does not make much sense: but i cant find where the foreach loop ends, too. Also the substr($lanip, 11, 3) = "0"; part seems very erro prone, maybe something like  s/\d{1,3}$/0/ is better (if i understand the will of OP)
HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.