use constant SELECT_USER_QUERY => q( SELECT userid, username, password FROM user_table, WHERE userid=? ); #...much later... my $sth = $dbh->prepare( SELECT_USER_QUERY ) or die DBI::errstr; $sth->execute( $userid ) or die DBI::errstr; my @data = $sth->fetchrow_array( $sth );