http://qs321.pair.com?node_id=1232380


in reply to Matching elements inside two array

There are multiple things wrong here.
Your code should always start with:
use warnings; use strict;
In general, an if within an if is wrong. This idea should be expressed if (X AND Y). That eliminates an indentation level and makes the code more clear. I have no idea what you are trying to do here..
if (grep { @input_B eq $_ } @input_array) { if (grep { @input_A eq $_ } @input_array) { foreach my $inputKey (@input_array)
Update: You ask "I have three arrays such as below. What I want to do is if the element inside the arrays match, then it will do something."

Please explain what a "match" between these 3 array's means? I could not deduce that algorithm from your post.