in reply to Re^3: Loop problem: jumps one record
in thread Loop problem: jumps one record
Code:blocked using dummy1 (total: 6) 3 rzxwrvxk.com 1 correio.biz 1 facebook.com 1 213.183.58.6 blocked using dummy2 (total: 330) 2 118.125.110.201 1 61.2.46.20 blocked using dummy3 (total: 5) 2 hinet.net 1 219.140.15.195 1 219.139.16.134 1 222.189.112.23 blocked using dummy4 (total: 53) 5 66.23.212.67 5 66.23.212.70 4 66.23.212.68 4 66.23.212.69 Relay access denied (total: 13) 1 46.183.217.174 1 46.183.220.137 1 46.183.220.138
Output I get :use strict; use warnings; my $ip=""; my $io; while (<>) { if (/blocked.using/) { do { $io = <>; $ip = $2 if $io =~ /(\d+)\s+(\S+)/; print $ip; #adding to database; } until ($io !~ /(\d+)\s+(\S+)/); } if (/Relay.access.denied/) { do { $io = <>; $ip = $2 if $io =~ /(\d+)\s+(\S+)/; print $ip; # adding to database; } until ($io !~ /(\d+)\s+(\S+)/); } }
rzxwrvxk.com correio.biz facebook.com 213.183.58.6 213.183.58.6 hinet.net 219.140.15.195 219.139.16.134 222.189.112.23 222.189.112.23 46.183.217.174 46.183.220.137 46.183.220.138
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Loop problem: jumps one record
by haukex (Archbishop) on Jan 31, 2017 at 13:13 UTC | |
|
Re^5: Loop problem: jumps one record
by tybalt89 (Monsignor) on Jan 31, 2017 at 18:24 UTC | |
|
Re^5: Loop problem: jumps one record
by poj (Abbot) on Jan 31, 2017 at 13:03 UTC | |
by math&ing001 (Novice) on Jan 31, 2017 at 13:09 UTC | |
by poj (Abbot) on Jan 31, 2017 at 13:22 UTC |