I think your problem is in parsing the output of your "fcping 50:06:0E:80:03:27:AA:11" command. You are currently assigning the multi-line output of the command to a scalar variable, $temp. It may make things clearer to assign the output to an array, then loop over the lines of output looking for your special string using a regex instead of split:
my @fcping_lines = `fcping $port`; for (@fcping_lines) { if (/\s+ and \s+ (.*?) \s+/x) { my $unsucces = $1; if ($unsucces eq "0") { print "Network Issue\n"; } else { print "Check HBA Status\n"; } } }

Make sure to use strict; use warnings and declare all you variables with my.

It may also be useful to check the success of your fcping commands, by checking the $? special variable.


In reply to Re: getuptime script by toolic
in thread getuptime script by deepupower123

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.