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
ROTECTED]] Sent: Monday, November 22, 1999 8:34 AM To: Redhat list Subject: Help with perl next if loop problem I am trying to write a perl script that will read a number from a file, use that as a counter, and only print out lines above that counter number. So if the number is 5 and the file is 10

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

Help with perl next if loop problem

1999-11-22 Thread gnielson
I am trying to write a perl script that will read a number from a file, use that as a counter, and only print out lines above that counter number. So if the number is 5 and the file is 10 lines, only the last 5 lines would be printed. The problem is when it prints out it misses one line, so inste