my @label = ( "F%", "G%" ); my $str = $dbh->prepare( "SELECT ID, NUM FROM INDEX WHERE ID like ? ); for ( @label ) { $str->bind_param( 1, SQL_VARCHAR ); $str->execute(); my ( $label, $num ); $str->bind_column( undef, \$label, \$num ); while( $str->fetch() ) { print "$label $num\n"; }