On Oct 31, 5:20 am, [EMAIL PROTECTED] (Beginner) wrote: > SELECT foo FROM bar WHERE foo like 'baz%'
If you are gonna make multiple queries then you should save a prepared statement handle as Jeff showed you. But if this is a one-off query then you can use one of the DBI shortcut methods (untested code): my $dbh = DBI->connect(...); my $sql = qq{select foo from bar where foo like 'baz%'}; my @results = @{ $dbh->selectall_arrayref($sql) }; No prepare/execute/finish needed. But I emphasize that if you do multiple queries where the only thing that changes is the target of the 'like' clause then you should prepare the statement (ONCE - not inside a loop) and later execute it (probably within a loop) with different arguments. FWIW, I found Chapter 13 of "Beginning Perl" helpful when learning DBI. You can read it online for free (legally) at http://www.perl.org/books/beginning-perl/ -- The best way to get a good answer is to ask a good question. David Filmer (http://DavidFilmer.com) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/