http://www.perlmonks.org?node_id=61968

kendroid has asked for the wisdom of the Perl Monks concerning the following question:

My question is similar to this one, but I'm pretty much a newbie so I have a question in addition: I understand how to throw a file line-by-line into an array, but how could I search the array for "Down" in one element and "Up" in a following (not necessarily the next) element? I'm trying to generate stats from a router log that looks something like this:
a_time_down Down a_time_up Up a_time_down Down a_time_down Down a_time_up Up
I have to come up with a aggregate downtime from a log like this. I found Time::ParseDate (what a blessing!), so once I know which Down element cooresponds with the next Up, tallying up the downtime shouldn't be a problem. Thanks so much for your help; I'm pretty new to Perl so please be kind. :)

Originally posted as a Categorized Question.