If you mean how do you capture output from such a tool into Perl, then where the rules of the "language" are simple enough, as in this case, the match operator can be used to detect and read the data.
use strict; use warnings; use POSIX ":sys_wait_h"; my $pid = open my $filehandle, "| speedfan"; # or whatever command it is my ($ltemp, $rtemp, $hdo); while( <$filehandle> ) { #reads the line into predeclared $_ # per line loop of output e.g. ... /^Local Temp:\s(\d+)C/ and $ltemp = $1 and next; /^Remote Temp:\s(\d+)C/ and $rtemp = $1 and next; /^HDO:\s(\d+)C/ and $hdo = $1; } close $filehandle; waitpid $pid,0; # wait for subprocess to terminate # $ltemp, $rtemp and $hdo now contain the temperatures.
In this case we assumed that the temperatures matched the expression \d+ (1 or more digits). A slightly more sophisticated expression is needed to match floating point data.

-M

Free your mind


In reply to Re: Motherboard Temperature by Moron
in thread Motherboard Temperature by Bruce32903

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.