in reply to MySQL and Perl - Shorthand
If four statements strikes you as being a great length, then hide the length by wraping it up in a subroutine.
then, you get the simplicity of print the_name(3);sub the_name { my $id = shift; my $sth = $db->prepare("select the_name from table where id = ?" +); $sth->execute($id); my ($the_name) = $sth->fetchrow_array(); $sth->finish(); return $the_name; }
|
|---|