in reply to Nested loop won't repeat

  1. putting your code into <code> tags:
    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"; } } } }
  2. re-seek or re-open your file before going thru it again and again:
    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"; } } } }
    []s, HTH, Massa