# subroutine to get date and time sub timecheck { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); # deal with the epoch and counting from zero $year += 1900; $mon += 1; } # make the directory for the year, month, and day as needed. # Specify the directory to which you'd like to store the capture files. &timecheck; #$logfiledir = "/home/george/capfiles/".$year.'/'.$mon.'/'.$mday; $logfiledir = sprintf("/home/george/capfiles/%02d/%02d/%02d", $year, $mon, $mday); mkpath( $logfiledir, {verbose => 1} );