Phoenix.pm: Code problem: Final Word

Giffin Ron-P08295 Ron.Giffin at motorola.com
Tue Oct 12 21:11:06 CDT 1999


Final word on my wc problem:  I guess Kevin and others were
right when they said it was a buffer flush problem ( although
I don't know why).  I added autoflush(1) before the print and
wc started working.  I moved open and close of $out_file inside
the loop and $size became correct.  Thanx again, great support.

  -- Ron


 
     open ( IN_FILE, $in_file ) || die ........
     open ( OUT_FILE, "> $out_file" ) || die .......
     while ( <IN_FILE> )
         {
         print OUT_FILE $_ ;
         $size = `wc -w $out_file | tr -s " " | cut -f1 -d " "` ;
         print "Unix word count = $size\n" ;
         }
     close ....
     close ....



More information about the Phoenix-pm mailing list