previous element in the array perl

Hi, How to get previous/next element in the array perl

Example

@queue = (1, 2 ,3 , 4);

I want to get value of 1 and 2, or, 2 and 3, or 3 and 4...etc and compare to value which one is greater to do that I need to get previous and next element of array ?

perl -e '
@queue = (1, 2, 3, 4);
print for map { "$queue[$_], $queue[$_+1]\n" } 0...$#queue-1'
1, 2
2, 3
3, 4

But I think I didn't understand you.