You should look up what prepare-statements do in SQL in general. The idea is that you define the form of the query or update in advance, giving the RDBMS a chance to construct the operation. You then send it repeated execute calls with specific values.
In your example, baz in the prepare call is a column name. $baz in the execute call is a value being substituted for the placeholder. The question mark is a placeholder. -Will > -----Original Message----- > From: Rajeev Prasad [mailto:rp.ne...@yahoo.com] > Sent: 29 July 2011 18:14 > To: dbi-users@perl.org > Subject: question on CPAN example for DBI > > Hello, > > I am trying to understand this code from CPAN hepl page: > > > > $sth = $dbh->prepare("SELECT foo, bar FROM table WHERE baz=?"); $sth- > >execute( $baz ); while ( @row = $sth->fetchrow_array ) { print > "@row\n"; } > > > what is execute doing here with $baz? what is $baz representing? > > thank you. > Rajeev