my @buttons = ( '9','8','7','6','5','4','3','2','1','0'); for (my $i = 9; $i >= 0; $i--) { my $button{$i} = $buttons[$i]; # for instance }