Hi,

As Skeeve points out, ping returns slightly differently on every system, so some output would help immensely.

It's maybe worth trying swapping the /\,/ for "," - this shouldn't make any difference (in my opinion, at least), but it seems to on my system (Perl 5.004.04 on Solaris).

An alternative way to do this, rather than the way you're doing it currently, would be to make use of the Net::Ping module. This has the capability of returning the ping time for individual pings in milliseconds, and from that it should be trivial to ping a host a number of times and calculate your average time and packet loss.

As far as rounding goes, you can use the printf and sprintf functions to output formatted numbers - it'll round into the bargain. For example ..

printf "%.1f", 29.28; # outputs 29.3

I hope that helps a little - good luck with the split ...

-- Foxcub
#include www.liquidfusion.org.uk


In reply to Re: MRTG script should be easy by Tanalis
in thread MRTG script should be easy by jalspach

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.