Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How to Test if Two Arrays are Ordered in the Same Way

by jdhedden (Deacon)
on Jun 06, 2005 at 16:23 UTC ( [id://463973]=note: print w/replies, xml ) Need Help??


in reply to How to Test if Two Arrays are Ordered in the Same Way

Your decision line needs to be:
my $decision = grep($h{$$ar2[$_-1]} > $h{$$ar2[$_]}, 1..$#{$ar2}) +? 0 : 1;
You have to take into account the elements order with respect to each other. In this case, pos1 <= pos2 <= pos3 ...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-25 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found