thanks, im totally pro at functions now! =) gimi a task involving sub routines and functions.. wanna see if im pro ^^
Code:
#!/usr/bin/perl -w
use warnings;
use strict;
sub one;
sub two;
print ("\nPlease Choose a converter \n \n celcius to farenheit (press 1) \n Farenheit to celcius (press 2) \n");
my $a = <STDIN>;
if ($a == 1) {
print ("You chose option 1. Enter your value below \n\n");
my $b = <STDIN>;
print one($b,32,1.8);
}
sub one {
my $var1 = ($_[0] * $_[2]) +$_[1];
return $var1;
}
if ($a == 2) {
print ("You chose option 2. Enter your value below\n\n");
my $c = <STDIN>;
print two($c,32,(5/9));
}
sub two {
my $var2 = ($_[0] - $_[1]) * $_[2];
return $var2;
}
maybe someone see any improvements here? =))))