in reply to getting answer 70 years off

When you do this subtraction time - $time, you get the number of seconds elapsed between the date you passed to the program and now. Then, when you apply localtime to that value, you are calculating the date that occurred that number of seconds after the epoch, i.e. Jan 1, 1970. So, assume you passed 01-17-2007, just 7 years ago, local time will return you the date just seven years after Jan 1, 1970, i.e. Jan 1, 1977. And  (localtime ( time - $time ))[5] will give you 77. If you subtract 70, you should get the right age, but there are date and time calculating modules (DateTime, for example) to do this calculation better for you.