http://www.perlmonks.org?node_id=968935


in reply to foreach only for a section of a list

perl -e '@set=qw(a b c d);for (@set[0..$#set - 1]){print "$_\n";}' a b c
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."