in reply to covert to string variable
SQL::Abstract can help greatly with this kind of thing.
use SQL::Abstract; my @user = qw( ABCDEF01 HIJKL678 VWXYZ123H ); my @like = map { substr($_,0,4) . "%" } @user; my $sql = SQL::Abstract->new; my ( $statement, @bind ) = $sql->select("User", "*", { -or => { username => { LIKE => \@l +ike } } }); print $statement, $/; print join(", ", @bind), $/; # Then some variation upon: $dbh->prepare($statement)->execute(@bind); __END__ SELECT * FROM User WHERE ( ( username LIKE ? OR username LIKE ? OR use +rname LIKE ? ) ) ABCD%, HIJK%, VWXY%
|
|---|