LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-13-2008, 06:24 AM   #1
baddah
Member
 
Registered: Feb 2006
Location: Cape Town,South Africa
Distribution: Fedora Core 8
Posts: 183

Rep: Reputation: 30
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
 
Old 05-13-2008, 06:56 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error using DBI with Perl bostonantifan Ubuntu 0 11-11-2007 02:47 PM
MySQL Perl DBI question GoTrolling Linux - Newbie 1 03-21-2007 05:31 AM
Perl - DBI PG Installation Problems TheMeteorPolice Linux - Software 2 11-23-2005 11:53 AM
perl | DBI->connect | RHEL AS 3 kaN5300 Linux - Enterprise 6 09-14-2004 09:15 AM
perl DBI prepare question mrtwice Programming 1 10-30-2003 03:12 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration