Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: concatenating variables

by suaveant (Parson)
on Jul 31, 2012 at 17:41 UTC ( #984634=note: print w/ replies, xml ) Need Help??


in reply to concatenating variables

There are ways to do this but it is generally considered bad practice to do so unless you have no other choice. Consider instead an array.

$lines[0] = "use pricedb"; $lines[1] = "second statement"; for my $sql (@lines) { $dbh->do($sql); # check code here }
That easily lends itself to pulling queries from a file or building queries programmatically. It also means you can have an arbitrary number of lines. I highly suggest getting
Learning Perl
And/Or
The Camel Book
If you are going to be doing any amount of Perl programming, both are very useful. Of course there are lots of online tutorials, too.

                - Ant
                - Some of my best work - (1 2 3)


Comment on Re: concatenating variables
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984634]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-07-24 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (160 votes), past polls