On Sun, Apr 6, 2008 at 5:36 AM,  <[EMAIL PROTECTED]> wrote:
> Hi,
>  I am doing some homework from the book Learning Perl chapter 4 excercise 1,
>  Looking at the script below, I wonder why line 6 (print "Enter some numbers 
> on separate line: ";) is not printed immediately after the previous print.
>  Thanks
>
>
>  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

Your system is buffering the output. See perldoc -q How do I
flush/unbuffer an output filehandle

>  my $user_total = &total(<STDIN>);
>  print "the total of those numbers is $user_total.\n";
>
>  sub total {
>   my $sum;
>   foreach (@_){
>   $sum += $_;
>   }
>   $sum;
>  }



-- 
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org

values of β will give rise to dom!

Reply via email to