You have warnings off; no wonder it runs without any messages :)

You're doing way too much work. If you simply make the ip address one number, it'll be a lot easier to sort on. I do that below by zero padding and joing the four numbers. You don't need to do anything with the time, since it's zero-padded, so you can sort it easily. For the date you can do the same: left-pad the numbers with zeros.

sub by_ip { my (%months, $i); $months{$_} = $i++ for qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct +Nov Dec); my $a_ip = join "", map { sprintf("%.3d", $_) } split /[.]/, $a->[ +0]; my $b_ip = join "", map { sprintf("%.3d", $_) } split /[.]/, $b->[ +0]; my @a_date = split '/', $a->[3]; my @b_date = split '/', $b->[3]; my $a_date = sprintf "%.2d-%.2d-%.4d", $a_date[0], $months{$a_date +[1]}, $a_date[2]; my $b_date = sprintf "%.2d-%.2d-%.4d", $b_date[0], $months{$b_date +[1]}, $b_date[2]; ($a_ip <=> $b_ip) || ($a_date <=> $b_date) || ($a->[4] <=> $b->[4] +); } sort by_ip @logentry;

I haven't tested it, since I do not know what your logfiles look like (post!).

Anyway, hope this helps.


ar0n ]


In reply to (ar0n) Re: Hella sort by ar0n
in thread Hella sort by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.