There's some issues with is_poll_time(). You're looping through all hours except one: 1 to 24 won't pick up 00:20. As it looks like you want all hours, that loop is entirely redundant; all you need is:
sub is_poll_time { for (@_) { my $t = gmtime $_; return 1 if $t->min == $poll_minute; } return 0; }
If you had needed that loop, it would have better written more like Perl and less like C. Consider whether you think this is clearer:
for my $poll_hour (0 .. 24) { # Process $poll_hour here }
Assigning to @$_[0] and @$_[1] is a poor choice: you're altering the original data. I question whether doing that is necessary here; however, as a general rule of thumb, assign to a new variable rather than altering the original data.
Pulling out parts of date/time strings with substr and doing various arithmetic calculations to generate seconds, minutes, etc. is prone to errors and, as far as I can see, extra work you don't need to do. I repeat what I said in my initial reply:
"Check the Time::Piece documentation to see how I've used it and for ways to format the output ..."
Use indentation to show the logical structure of your code. This makes it easier for everyone (including yourself) to read and follow. It also makes it less prone to errors and, when errors do exist, easier to find them. You only have a small script so uneven and inconsistent identation was not a huge impediment; when you start writing more complex code it will make a big difference. See "perlstyle - Perl style guide" for hints and tips in this area.
Please do not post vast swathes of data such as you've done here. Only post enough to illustrate whatever point you're making. If you do consider it necessary to post pages of data, use <readmore> of <spoiler> tags which are explained here: "Writeup Formatting Tips".
-- Ken
In reply to Re^5: Epoch based parser
by kcott
in thread Epoch based parser
by spikeinc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |