The following works, but is this the way to go? #!/usr/bin/env perl
use strict; my ($min_yr, $max_yr); $min_yr =(localtime)[5] + 1900 - 18; $max_yr = (localtime)[5] + 1900 - 73; for (reverse($max_yr .. $min_yr)){ print "\<option value=\"$_\">$_\<\/option\>\n"; } Mimi On 16 September 2013 14:36, mimic...@gmail.com <mimic...@gmail.com> wrote: > I have this simple script to automatically print HTML selection option. > > #!/usr/bin/env perl > > use strict; > > for (reverse(1943 .. 1991)){ > print "\<option value=\"$_\">$_\<\/option\>\n"; > } > > > I need to print all the years between 18 and 73 without hard coding the > range in the for loop as in the above. I am considering the use of > localtime to compute the current year as below $yr=(localtime)[5], but I > can't think of an easy way to achieved what I want to do. > > Any help appreciated. > > Mimi >