[EMAIL PROTECTED] wrote:
I have a regular'ol ASCII file which I'll need to read only the first
line, and parse the three numbers that are seperated by commas and
print the results.
<snip>
How do I go about opening this file, reading the first line, parsing
the three numbers into variables,
This is one way:
open my $DCTEMP, '<', '/tmp/current_dctemp' or die $!;
my ($temp, $humidity, $lumes) = split /[,\s]+/, <$DCTEMP>;
then printing the results?
Example:
print "Content-type: text/html; charset=iso-8859-1\n\n";
print "<p>Current Temperature: $temp<br>\n",
"Current Humidity: $humidity<br>\n",
"Current Illumination: $lumes</p>\n";
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/