in reply to Updating variable in a loop
If I understand you correctly, here's an untested example that should provide guidance:
my $count = 0; my @sent; while (get_entry_from_db()){ if (/match/){ ...; # send email and do other stuff $count++; push @sent, [$contact, $email]; } } print "users mailed: $count\n"; for my $entry (@sent){ my ($contact, $email) = @$entry; print "email sent to: $contact <$email><br>"; }
I've used an array of arrays here, instead of just appending the full string to the array, but you can go that route as well.
update: changed default var to named in for() loop for clarity
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Updating variable in a loop
by htmanning (Friar) on Jun 07, 2016 at 22:18 UTC |