http://qs321.pair.com?node_id=1165115


in reply to Updating variable in a loop

You can use something like the following to construct one large string:
my $log = ""; for my $item (@stuff) { do_something($item); $log .= "Email sent to: $item<br>\n"; } print $log_file $log;
The  $log .= "..." appends the string to $log each time through the loop so at the end, it's one large string.