#!/usr/bin/perl -wT use strict; my $arrayref = ['A','B','C','D']; print "Before: ", join(' ',@$arrayref), "\n"; @$arrayref[1,2] = @$arrayref[2,1]; # assign into an array slice print "After : ", join(' ',@$arrayref), "\n"; =output Before: A B C D After : A C B D