my @array = ( 'A' .. 'F' ); my $ref_number = 42; # or whatever my $index = ( $ref_number - 1 ) / 8; my $bundle = $array[ $index ]; print $bundle;