use constant STICK2 => [ 15, map( ($_) x 2, 15 .. 23 ), (24) x 100 ]; sub stick2{ my $q = STICK2->[ $_[0] / 1000 ]; return $q < $_[1] ? $_[1] : $q; }