LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Perl DBI Queries (http://www.linuxquestions.org/questions/programming-9/perl-dbi-queries-641849/)

baddah 05-13-2008 06:24 AM

Perl DBI Queries
 
Hi,

What is the difference between the following two queries in Perl?(using DBI)

Code:

$dbh->prepare(qq{SELECT COUNT(*) FROM Messages WHERE client_address=? AND Time_Stamp >= ?})
and

Code:

$dbh->prepare(SELECT COUNT(*) FROM Messages WHERE client_address=? AND Time_Stamp >= ?)
So in other words,what is the purpose of the qq part before the query. I have never used it before, but i've come accross a lot of samples where they use the qq and i can't find any explanation for the reason of this.

Does anyone know?

thanks

chrism01 05-13-2008 06:56 PM

See here: http://perldoc.perl.org/perlop.html#...Like-Operators
in short qq string => A double-quoted, interpolated string.
ie string is surrounded by double-quotes and any perl vars are interpolated ie set to their values.
eg
$v1="a"
and we have
qq{some string $v1}
this becomes
"some string a"

HTH


All times are GMT -5. The time now is 07:36 PM.