compare two value in array - Perl

Hi, I just wondering if I want to compare previous value to next value if it same count + 1 if not doesn't count how do we compare in Perl? Thank

What have you tried so far? How are you accessing the array (directly? in a loop? what kind of loop?) What kind of "count" has to be increased?

actually wat I tried to do is to make program that simulated LRL ( Least Recently Loaded ) like Paging Algorithms so the program count for page fault

#!/usr/bin/perl -w

print "Enter page Access";
chomp ($item = <STDIN>);
my @queue = split /\s+/, $item;
print "Enter a page frame";
$frame = <STDIN>;
if ( $frame >= 3 )
{
    
    
    for ($queue[0]..$frame)
    {
        $pageFault = 0;
        if (grep {$_ eq } @queue)
        {
            $pageFault = $pageFault + 0;
        }
        else
        {
            $pageFault = $pageFault + 1;
        }
    }
    print "$pageFault\n";