Hi,

here is my code

my @intf_list = ("xe-4/0/1", "xe-2/2/1"); foreach my $myint (@intf_list) { my @outputlist = split m([-/]), $myint; push (@fpc, $outputlist[1]); push (@pic, $outputlist[2]); push (@port, $outputlist[3]); print "my fpc of intf is $fpc[0]\n"; print "mu pic is $pic[0]\n"; print "my port is $port[0]\n";

Above execution results in my fpc of intf is 4 mu pic is 0 my port is 1 which is working fine as as per my expectation

Now, as per the following output. Adding the output in code section

show chassis fpc pic-status 4 Slot 4 Online MPC4E 3D 2CGE+8XGE PIC 0 Online 4x10GE SFPP PIC 1 Online 1X100GE CFP PIC 2 Online 4x10GE SFPP PIC 3 Online 1X100GE CFP

i want to find , how many PIC are there and there numbers say, PIC 0 , PIC 1 etc and find whether its online and also find whether it has only 10GE port. And compare, this PIC number with the above output $pic and do a decision. I tried the following code based on the output of the previous code section

$rh->cmd("show chassis fpc pic-status $fpc[0]"); my $output = $rh->get_response; my @outputlist = join s/(^\s+|\s+$)//g, $output;

I thought to elimate the space and combine all the test from the output, and then do a regexp to find the required parameters as mentioned above. But, i do not see any difference in the output, after the above code is executed. Is there a way to solve this?


In reply to Regexp question on combining white spaces and comparisons by Anonymous Monk

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.