Technically the question and answer is OT (off topic) because the
difference has to do with Perl quoting features and is not specific to DBI.
However, it does illustrate some techniques that can make the
SQL passed to DBI calls more readable (IMHO) than when you use conventional quotes ("" 
or '').

A short answer is that these are various alternatives that Perl provides for 
supporting multiline quoting...
<<SQL_END represents a string built from the next few source lines, up to a sentinel 
string (SQL_END in your example).  Like a here-doc in shell.  The text can interpolate 
(i.e. $var variables in the text are expanded).  Use <<'SQL_END' to suppress 
interpolation.
qq{text} is like "text", and supports interpolation.
q{text} is like 'text', no interpolation.

Consult the Perl docs for more info.

-----Original Message-----
From: Robert [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 29, 2004 8:51 AM
To: [EMAIL PROTECTED]
Subject: Different types of prepare statements

I have seen:

my $sth = $dbh->prepare( <<SQL_END );
SELECT blah
FROM blah
WHERE blah = blah
SQL_END

my $sth = $dbh->prepare(q{
SELECT blah
FROM blah
WHERE blah = blah
});

my $sth = $dbh->prepare(qq{
SELECT blah
FROM blah
WHERE blah = blah
});

What is the difference? I am new to Perl/DBI stuff.

Robert


Reply via email to