Thanks for the repsponse guys!!! With your help ( really the direct
answer ) I was able to get this going! Below is my final script that
works like a charm.

The only question for learning purposes is, what does "=~ /[-+]?[\d.]+/
g;" actually do? My Perl Cookbook doesn't explain ( or I just don't
know where to look ) to me how that parsed each field within the first
line of the file I'm opening...

Thanks again for the help --


#!/usr/bin/perl
# dctemp.pl created: 3-16-2008 SZK
#
# This script will parse three numeric fields from a static file
# that is created /usr/local/scripts/root/temperature_check/
sensorcheck.sh
# via cron. I have redirected the output from the above script to
write
# a tmp file called /tmp/current_dctemp. This simply reads this file
# parses the first line and displays in a nice simply web page.
# http://***********/dctemp/dctemp.pl
# Special Thanks to Perl.Beginners group to John for the help.

#
# Set Vars
#
my $date=localtime;

#
# Run Program
#
open my $DCTEMP,'<','/tmp/current_dctemp' or die "Cannot open '/tmp/
current_dcte
mp'$!";
my ( $temp, $humidity, $lumes ) = <$DCTEMP> =~ /[-+]?[\d.]+/g;
close $DCTEMP;

print "content-type: text/html \n\n";
print "<HTML><BODY><P>";
print "<meta http-equiv=\"refresh\" content=\"300\"";
print "<HEAD><title>Data Center Temperture</title></HEAD>";
print "<H2>Data Center</H2>";
print "Date: $date <BR>";
print '<form action="dctemp.pl" method=post> <P> <P><BR>';
print "Temperature: $temp\F\n <BR>";
print "Humidity: $humidity\n <BR>";
print "Illumination: $lumes\n <BR><BR>";
print '<input type=submit value="Update Reading"><BR><BR>';
print "Note 1: The Tempererture sensor is located in the middle heat
row on a ca
ble bridge 2 feet below ceiling level. <BR>";
print "Note 2: This Page Will Auto-Refresh Every 5 Minutes. <BR>";
print "Note 3: WARNING, Illumination Index may be high! Wear
sunglasses in the D
ata Center if needed. ( Why the heck these devices have light sensors
we'll neve
r know... )";
print "</form>";
print "</BODY></HTML>";


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to