-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I am trying to get this to take random amount of widths and compute
the square footage for each. For example:
Enter Total Square Footage: 1234
Enter widths seperated by spaces
3 4 5
size 3: amount needed = 0
size 4: amount needed =
size 5: amount needed =
below is the code I have so far:
# Random width calculator
$| = 1;
print("Enter Total Square Footage: ");
chomp($squareft = <>);
$| = 0;
print("Enter widths seperated by spaces: \n");
while(@numbers = <>)
{
# Extract widths
@width = split(" ", $numbers);
$result = &calculate($width);
print("size = $width amount needed = $result \n");
}
sub calculate{
my $a = shift @_;
my $value = $a / 12;
my $b = $value * $squareft;
return $b;
}
formula for random width is( for each width divide by 12, take that
number and multiply by total square footage)
Some pointers, hints, maybe a doc link anything would be appreciated.
thanks again
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
iD8DBQFFbso6mGeA9U+OoOcRAtxAAJwMPF9Uq8iAwDR3xCYrFO92cGGkXwCcCk+7
NC8qEWPwlmX0y2jl4bfKQsw=
=l97N
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>