use integer; # speeds up the math my @date = localtime(time); # convert year to months and add current number of months my $yearnow = ((($date[5] + 1900) * 12) + ($date[4] + 1)); print "Enter an 8 digit birthdate. eg: 01/01/1970\n"; my ($monththen, $daythen, $yearthen) = split /\//, ; # we'll fly without error-checking now and just add what they entered for month my $modyearthen = (($yearthen * 12) + ($monththen)); # subtract the totals and divide by 12, convert to int (redundant for safety sake) # and voila actual number of years alive $numyears = int (($yearnow - $modyearthen)/12); print "You've been around $numyears years!\n";