StormMedic85
Programmer
In the second foreach loop, I simply want to apply each value in the array into that equation. It appears to be combining them. I can't find a good internet reference. Any help would be appreciated.
#!/usr/local/bin/perl -w
use strict;
my (@temps, $item, $MYFILE, $val, $es);
@temps = ('-12', '-13', '-14', '-15');
&vaporpressure();
sub vaporpressure
{
foreach $item(@temps) {
$item += 273.15;
}
foreach $val(@temps) {
$es = 611.2*exp(5417*((1/273.15)-(1/$val)));
}
print $es;
}
exit;
#!/usr/local/bin/perl -w
use strict;
my (@temps, $item, $MYFILE, $val, $es);
@temps = ('-12', '-13', '-14', '-15');
&vaporpressure();
sub vaporpressure
{
foreach $item(@temps) {
$item += 273.15;
}
foreach $val(@temps) {
$es = 611.2*exp(5417*((1/273.15)-(1/$val)));
}
print $es;
}
exit;