-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Adriano Ferreira wrote:
>
>> STDIN and then make a loop for them. So you should remove the
>> construction of @numbers from the loop, doing
>
>
>
> Code now is:
>
print("Enter widths separated by spaces: \n");
my @numbers = split /\s+/, <>;
    for my $width (@numbers) {
        my $result = &calculate($width);
            print("size = $width amount needed = $result \n");
    }


sub calculate {
    my $a = $_;
    my $value = $a / 12;
    my $b = $value * $squareft;
    return $b;
}

Here is the results:
Enter Total Square Footage: 1200
Enter widths separated by spaces:
2 3 4
Use of uninitialized value in division (/) at calc.pl line 23, <> line 2.
size = 2 amount needed = 0
Use of uninitialized value in division (/) at calc.pl line 23, <> line 2.
size = 3 amount needed = 0
Use of uninitialized value in division (/) at calc.pl line 23, <> line 2.
size = 4 amount needed = 0

It is pulling the size out nicely, but the value isnt making it into
the sub??  I have tried my $a = $_[0] , a = @_, a = $width and am lost
now.

thanks again
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
 
iD8DBQFFbuNPmGeA9U+OoOcRAiIGAKCQNhq7ZVonPuw7DC0sTxY3HkCdcwCeOxP8
UJUdqByp2gR9/rwo18Q1EC0=
=5eIq
-----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>


Reply via email to