What do you think of this?
use Modern::Perl; while (<DATA>) { # get rid of header block last if /--TX--/; }; while (<DATA>) { my ($port, $speed, $duplex, $TX, $RX, $link, $name) = split; next unless $link eq 'up'; say <<EOP; Port is $port Speed is $speed Link is $link EOP } __DATA__ ------------------------------------------------------------------ Port Speed Duplex Flow Ctrl Link Name ---- ----- -------- --TX-----RX-- ------ ------ 1 10000 full no no down 1 2 10000 full no no down 2 3 10000 full no no down 3 4 10000 full no no down 4 5 10000 full no no down 5 6 10000 full no no down 6 7 10000 full no no down 7 8 10000 full no no down 8 9 10000 full no no down 9 10 10000 full no no down 10 11 10000 full no no down 11 12 10000 full no no down 12 13 10000 full no no down 13 14 10000 full no no down 14 15 10000 full no no down 15 16 10000 full no no down 16 17 1G/10G full no no down 17 18 1G/10G full no no down 18 19 1000 full no no up 19 20 10000 full no no down 20

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

In reply to Re: how to put the value in proper format by CountZero
in thread how to put the value in proper format by ulaksh

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.