-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Adriano Ferreira wrote: > On 11/30/06, Chris Parker <[EMAIL PROTECTED]> wrote: >> while(@numbers = <>) { >> >> # Extract widths @width = split(" ", $numbers); > > Here at this piece of code, @numbers and $numbers are different > variables. And you never assign anything to $numbers. Probably you > want this: > > while (<>) { # read a line my @numbers = split /\s+/, $_; # split > the line (using spaces as the delimiter) > > I added what you suggested and this is what I get now:
Enter Total Square Footage: 1200 Enter widths separated by spaces: 3 4 Argument "3 4" isn't numeric in division (/) at calc.pl line 27, <> line 2. size = amount needed = 300 I am missing something, probably very obvious. It isn't getting the split numbers. Code is: while(<>) { # Extract widths chomp(); my @numbers = split /\s+/, $_; my $result = &calculate; print("size = amount needed = $result \n"); } sub calculate { my $a = $_; my $value = $a / 12; my $b = $value * $squareft; return $b; } thanks again for your help -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFbtlkmGeA9U+OoOcRApbxAJ4qR/h9YEjsOa3/pwtWyFKTzgbELgCgjvG7 wQsCL1u3pf+xsicNGds8ixA= =hq8M -----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>