in reply to Re^5: Loop problem: jumps one recordin thread Loop problem: jumps one record
Ok, since you didn't detail the criteria you need to adapt this as required
#!perl use warnings; use strict; my $criteria; while (<>) { next unless /\S/; # skip blank lines if (/(Relay access denied|blocked using)/){ $criteria = $1; next; } if (/\d+\s+(\S+)/ && defined $criteria){ print "update db $criteria = $1\n"; } else { $criteria = undef; } } [download]