Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How do I compare two strings against two arrays respectively?

by ariels (Curate)
on Mar 27, 2001 at 17:43 UTC ( [id://67486]=note: print w/replies, xml ) Need Help??


in reply to How do I compare two strings against two arrays respectively?

Here's another way to do it, if I correctly understand what you want to do. You want to find an index $i for which $a[$i] eq $a and $b[$i] ne $b (that is, your condition holds at the same index). So why are you searching the array elements? It's better to search for an appropriate index!
@indices = grep { $a[$_] eq $a and $b[$_] ne $b } (0..$#a);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-19 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found