Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use Time::Local; %month = ( "Jan", 0, "Feb", 1, "Mar", 2, "Apr", 3, "May", 4, "Jun", +5, "Jul", 6, "Aug", 7, "Sep", 8, "Oct", 9, "Nov", 10, "Dec", 11 + ); &eTime; sub eTime { my ($x, $y); my ($month, $day, $year, $hour, $min, $sec, $epoch) @y = split(/ /, $x); ($mm1, $day, $year) = split(/\//, $y[0]); ($hour, $min, $sec) = split(/:/, $ss[1]); $moty2 = $month{$moty1}; $day = $day + 0; $hour = $hour + 0; $min = $min + 0; $sec = $sec + 0; $epoch = timelocal($sec, $min, $hour, $day, $mm2, $year); return $epoch; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to create a subroutine function to return epoch time from syslog file
by blindluke (Hermit) on Feb 05, 2015 at 08:35 UTC | |
by Anonymous Monk on Feb 05, 2015 at 14:26 UTC |