I am trying to learn about binding variables. i am writing a simple script that with select a row of records and print them to screen. I am getting the error Can't call method "bind_param" on an undefined value at porqout.pl line 29. Here is the code below. #!/usr/bin/perl -w use strict; use DBI; my $ctn_number='67846270';
$dbh->prepare("select * from ctn_inv where ctn = ?"); $sth->bind_param( 1,$ctn_number); $sth->execute(); $dbh->prepare("select * from ctn_inv where ctn = ?"); $sth->bind_param( 1,$ctn_number); $sth->execute(); while( my @record= $sth->fetchrow_array()) my $record_list = join ',', @record; print "\n$record_list"; my $sth->finish; $dbh->disconnect; exit;