Had a beer at lunch and don't feel like doing my own work...

use strict ; use warnings ; my @data = sort <DATA> ; my %min ; foreach (@data) { my ($col1, $col2, $col3) = split /\s+/, $_ ; $min{$col2} = $col1 if (! defined $min{$col2}) ; print $_ if ($col1 eq $min{$col2}) ; } __DATA__ -1 2 ereu 1 2 rerer 2 2 rere 3 2 eee 3 2 wwwe 9 2 qqewew 9 2 vvvgf -1 2 wwwew 4 3 wwew -9 3 wwss 6 3 jjuu 7 3 kkii 7 3 ggtyu 8 3 ffder 1 4 rrtrr 1 4 rree

In reply to Re: Selective Printing of Lines by onelesd
in thread Selective Printing of Lines by polsum

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.