Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Matching elements inside two array

by Marshall (Abbot)
on Apr 10, 2019 at 05:24 UTC ( #1232380=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1232380]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2020-07-12 10:04 GMT
Find Nodes?
    Voting Booth?

    No recent polls found