in reply to Find last position of an element in array
one possibility is to loop backwards, $array[-1] gives you the last element and so on.
please note that this is illegal incorrect syntax
> $array=(1,1,1,2,2,2,2,2,3,3,3,4,4,4,4,4,4,5,5,6);
you most probably meant
@array=(1,1,1,2,2,2,2,2,3,3,3,4,4,4,4,4,4,5,5,6);
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Find last position of an element in array
by hippo (Archbishop) on Mar 28, 2022 at 18:06 UTC | |
by LanX (Saint) on Mar 28, 2022 at 19:44 UTC |