use strict; my @dir = qw{ dir1 dir2 dir3 }; my $target=shift(@dir); push(@dir,$target); print "$target\n";