#!/usr/bin/perl -w use strict; my $t= -181; for (my ($i,$j) = (30,1); $i <= 180; $i += 30, $j++) { if ($t <= $i) { print $j; last; } }