use POSIX; # this module defines the function mktime $last='2/21/5/19:22:14'; # this is the timestamp of the user's last login $now=time; # the present ($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($now-86400); # a day ago ($mon2,$mday2,$wday2,$hr2,$min2,$sec2)=($last=~m|^(\d+)/(\d+)/(\d+)/(\d+):(\d+):(\d+)|) or die "Wrong timestamp: $last\n"; # extract values from the timestamp, with a bit of checking $last_time=POSIX::mktime($sec2,$min2,$hr2,$mday2,$mon2,$year); # transform the timestamp into a unix-time (seconds since the epoch) unless (defined $last_time) {die "Wrong timestamp: $last\n"} # mktime will return undef if the date is not valid print "In range" if ($now-$last_time)<86400; # if the difference is less than a day...