$i = 0; where 12 is the size of my array. and i is an index, or is there an alternative? while($i != 12){ if($month = $array[i]){ print "yes it's a month\n"; } } #### for $i (0..$#array) { # just in case they change the number of months :) next unless ($month eq $array[$i]); # skip if not equal print "Yes its a month\n"; last; # no need to check other months so exit loop }