In article <[EMAIL PROTECTED]>, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
> I don't understand what you mean. However, the code below confuses me > for another reason. > > > use strict; > > use warnings; > > my @fred = qw/1 3 5 7 9/; > > my $fred_total = &total(@fred); > > print "The total of [EMAIL PROTECTED] is $fred_total.\n"; > > print "Enter some numbers on separate line: "; ## line 6 > > my $user_total = &total(<STDIN>); > > When I tried the program, that line didn't work for me. Shouldn't it > rather be for instance: > > my $user_total = total( split ' ', <STDIN> ); > > so that <STDIN> gets evaluated in scalar context? No, it should be as posted. Remember, this is _Learning Perl_, and it's only up to Chapter 4 so far. We haven't talked about string processing yet, so everything is line oriented, as noted in the prompt text. :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/