#!/usr/bin/perl use strict; use warnings; my @nums = ( 1 .. 1000 ); foreach my $num ( @nums ) { my $test_n = int( ($num-1) / 30 ) + 1; print "Num: $num - $test_n \n"; }