in reply to Re: reading lines from a text file
in thread reading lines from a text file

thanks guyz for ur replies... i got what i wanted to do.. here is the sample code:
while($line=<FH>) { print "$line \n"; while(<FH>) { print "Next line is $_ \n"; } }
Using $_ worked for me in my application. I replaced variable $nextline with $_, so that the inner "while" works with $_ until the condition and $line will continue from where $_ left ( i.e. file handler). Thanks once again guyz. take care and have fun

Replies are listed 'Best First'.
Re^3: reading lines from a text file
by tilly (Archbishop) on Dec 27, 2008 at 15:20 UTC
    Random tips. You should use strict.pm which means you want a my in declaring $line. Also an 8-space indent is too much - in studies comprehension is best with an indent of 2-4 spaces. (There seems to be a marginal benefit to 4 spaces.)

    Sure, these points may look picky. But a good style comes from consistency on trivial details.