Why does the script hang when I try to read the last line of the file using <STDIN>?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Manikank

    Why does the script hang when I try to read the last line of the file using <STDIN>?

    I have a multiple lines file that I read. It reads all lines except for the last line

    Code:
    if (defined($$bb = <STDIN>)) 
    	{
    
                    print LOG" in if condition\r\n"; 
    		$readCount += length($$bb);
    		if ($readingFile) {
    			$fileCount += length($$bb);
    		}
    		
    		return 1;
    	}
    else {
              print LOG" in else condition\r\n"; 
              return 0;
     }
    The print statement got executed for all the lines of the file and did get executed (either in the if or else) for the last line of the file.
    Last edited by numberwhun; Oct 13 '10, 09:51 PM. Reason: Please use CODE tags!
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Are you trying to read from a file, using <STDIN>? Can you post the rest of your code please? I would love to see how you have this setup.

    Regards,

    Jeff

    Comment

    Working...