"Dr. Claus-Peter Becke" schreef: > databaserequest_noun($col, $table, $case) is a self written function > based on the dbi manual's proposals. here's the code: > > sub databaserequest_noun > { > my ($col,$table,$case) = @_ ; > my ($database, $hostname) = ('lexikon', 'localhost') ; > my $dsn = "DBI:mysql:database=$database; host=$hostname" ; > my ($user, $pass) = ('myusername', 'mypassword') ; > my $dbh = DBI::->connect( $dsn, $user, $pass, > { 'RaiseError' => 1, 'AutoCommit' => 1 } ) > or die DBI::errstr ; > my $sql = ("SELECT $col FROM $table where $col LIKE > '%$Q::lexicalentry%' AND case LIKE '%$Q::case%'") ;
(slightly reformatted) Where is this Q coming from? Have you considered to use placeholders? > [...] > $dbh->disconnect; > } > > maybe anybody detects the reason why the return value becomes 1 after > having assigned databaesrequest_noun to a new variable which shall be > used inside an if-clause. print @row returns a string value as > required. What is your sub supposed to return? <quote source="perlsub"> The return value of a subroutine is the value of the last expression evaluated by that sub [...] More explicitly, a "return" statement may be used to exit the subrou- tine, optionally specifying the returned value [...] </quote> -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>