Re: Help with perl next if loop problem

1999-11-23 Thread Gordon Messmer
Glen Lee Edwards wrote: > open(FD,"$file") || die "Can not open $file"; > while() { > > while ($line = ) > { > print "lineNo is $. and text is $text\n"; > > next if ($. < $text); > print $line; > } > } > close FD; I don't t

Re: Help with perl next if loop problem

1999-11-23 Thread Glen Lee Edwards
Actually this will work better. You have a double while loop. It may work, don't know, never done it that way. open(FD,"$file") || die "Can not open $file"; while() { print "lineNo is $. and text is $text\n"; next if ($. < $text); print $line; } close FD; $. is a special v

Re: Help with perl next if loop problem

1999-11-23 Thread Glen Lee Edwards
Try: open(FD,"$file") || die "Can not open $file"; while() { while ($line = ) { print "lineNo is $. and text is $text\n"; next if ($. < $text); print $line; } } close FD; $. is a special variable containing the current in

RE: Help with perl next if loop problem

1999-11-22 Thread Thern Nathan R Capt SMC/XRI
Your first "while" statement is completely superflouos and is the cause of your problem. You think your line number is 0 when you've actually read two lines. You also need an increment statement for $lineNo. hth nate -Original Message- From: gnielson [mailto:[EMAIL PROTECTED]] Sent: Mond

Re: Help with perl next if loop problem

1999-11-22 Thread Charles Galpin
I can't make heads or tail of your version, bu this works for me. #line.pl #!/usr/local/bin/perl open (FILE, $ARGV[0] ) or die "$!\n"; my $count = ; chomp($count); $line = 1; while ( ) { print if $line++ > $count; } #line.txt 3 line1 line2 line3 line4 line5 line6 line7 [cgalpin@pooh perl