in reply to multiple conditions while loop

It seems like the natural thing here is to pass your desired target handle as an argument to the subroutine rather than using a closure -- see perlsub for info on how to use subs in Perl. Your code might look like:
sub write1 { my $STH = shift; while ( @data=$STH->fetchrow_array() ) { print "<CENTER>"; print "<TR>"; print "<TD BGCOLOR='red'>"; print "<P ALIGN='CENTER'>"; print "<FONT COLOR='white'>"; } }

Alternatively, if you mean a closure that systematically goes over three previously defined statement handles, you can wrap your while loop in a foreach loop like:

sub write1 { foreach my $STH ($STH1, $STH2, $STH3) { while ( @data=$STH->fetchrow_array() ) { print "<CENTER>"; print "<TR>"; print "<TD BGCOLOR='red'>"; print "<P ALIGN='CENTER'>"; print "<FONT COLOR='white'>"; } } }

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.