in reply to Re^2: Stuck Value
in thread Stuck Value

ok then to index the last five elements of an array say @arr up to and including $i, use the array slice
$arr[ ($i - 4) .. $i ]
update: and to avoid trying to index below 0: and suggesting an inequality function:
my $h = $i - 4; if ( $h >= 0 ) { if (unequal ( $arr[ $h .. $i ] ) { # flag stuck value } } # ... sub unequal { my %v = map { ($_, 1 ); } @_; my @v = keys %v; return $#v; }

One world, one people