in reply to Re^3: Problem in using 'ëxists" function to see if a key exists for a hash
in thread Problem in using 'ëxists" function to see if a key exists for a hash

Sorry for the error in the question. If the array element is not present in the keys of the hash%orgin, add it as a key.But here it is not happenning but don't understand why.Please help me understand what is going wrong with the code
  • Comment on Re^4: Problem in using 'ëxists" function to see if a key exists for a hash

Replies are listed 'Best First'.
Re^5: Problem in using 'ëxists" function to see if a key exists for a hash
by poj (Abbot) on Feb 17, 2016 at 09:34 UTC
    array @port_list which I get by reading a input file

    Maybe your error is in the reading code which you haven't shown.
    Have you Dumped @port_list to check ?

    Update ; It looks like you may have leading spaces on the duplicates. Try adding another regex line

    foreach my $val (@port_list) { $val=~s/\s+$//; $val=~s/^\s+//; # add print "[$val]\n"; . . .
    poj
      Thanks very much. It worked!! :)