foreach $hour ( @hourRange ) { $timeBlock = $timeDateBase . $hour; print "$timeBlock\n"; while( <LOG> ) { chomp; if( $_ =~ /$timeBlock/ ) { print "$timeBlock\n"; ( $a, $b, $c ) = split( /"/, $_ ); if( $a =~ /^(\S+)\s-\s-\s\[(\S+)\s/ ) { $IP = $1; $timeString = $2; print "$IP\n"; print "$timeString\n"; } } } }
foreach my $hour ( @hourRange ) { my $timeBlock = $timeDateBase . $hour; print "$timeBlock\n"; seek LOG, 0, 0; ## <== seek to the begin of LOG while( <LOG> ) { chomp; if( $_ =~ /\Q$timeBlock\E/ ) { print "$timeBlock\n"; my($a) = split( /"/, $_ ); ## <== only used $a if( $a =~ /^(\S+)\s-\s-\s\[(\S+)\s/ ) { my $IP = $1; my $timeString = $2; print "$IP\n"; print "$timeString\n"; } } } }
In reply to Re: Nested loop won't repeat
by massa
in thread Nested loop won't repeat
by numlock00
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |