Hi, fellow monks
I have a logfile composed of 7 lines;
I'd like to start processing at line X and stop at line N;
This next exit the while and I cant get why, could you help ?
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $maxline = 5; open my $info, "testlog" or die "Could not open $!"; my $start = 2; my $count = 0; while( my $line = <$info>) { next if $count < $start; print $line; last if ++$count == $maxline; print "$count \n"; }
In reply to next in while loop not honored by mitchreward
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |