use strict; no warnings; my @array = reverse 'a' .. 'j'; my $var = shift() - 1; print join '', reverse @array[0..$var];