programming-examples/perl/Array/Reverse a sub-range of an array.pl

4 lines
100 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
@array = (1, 2, 3, 4, 5, 6);
@array[2 .. 4] = reverse @array[2 .. 4];
print join (", ", @array);