#!/usr/bin/perl $curr_day = int time / (3600 * 24); open SHADOW, "/etc/shadow"; while () { @entry = split ':'; if ($entry[2] + $entry[4] - $curr_day == 5) { open MAIL, "|mail $entry[0]"; print MAIL "Your password will expire in five days.\n"; print MAIL "Please change it as soon as possible.\n"; close MAIL; } }