in reply to Re^3: remove element from 2D array after comparing it with other 2D array
in thread remove element from 2D array after comparing it with other 2D array

Hi Haukex, first of all, thank you so much for your effort.

I'm sorry but since I'm not very familiar with this language, I find it a bit hard to comprehend this code. May I know what is this part means:

my ($highest_match, $highest_match_at_a1idx) = (-1);

You have stated in the code that it will look through @array1 for the best match, but I search the (-1) function in google but they did not gave me information that I can relate with this.

I also a bit confuse with the function of .pp in your code. Does this store the variable somewhere?

Really appreciate if you can answer this. Thank you again sir.

  • Comment on Re^4: remove element from 2D array after comparing it with other 2D array
  • Download Code

Replies are listed 'Best First'.
Re^5: remove element from 2D array after comparing it with other 2D array
by hippo (Archbishop) on May 03, 2019 at 10:15 UTC
    my ($highest_match, $highest_match_at_a1idx) = (-1);

    You might not have spotted it but this is merely list assignment. The list on the right of the equals sign is assigned to the list on the left, so after this assignment, $highest_match has value -1. Since the left list has 2 elements but the right list has only 1, the second element on the left $highest_match_at_a1idx is undef.

    I also a bit confuse with the function of .pp in your code. Does this store the variable somewhere?

    No, it's just a pretty printer. See Data::Dump::pp.

      Okay got it now. Thank you so much for the explanation.