Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Answer: Calling a method within a double-quoted string?

( #17473=categorized answer: print w/ replies, xml ) Need Help??

Q&A > object-oriented programming > Calling a method within a double-quoted string? contributed by plaid

You should use place holders in this case, as they automatically take care of quoting:

my $sth = $dbh->prepare("select * from foo where bar = ?"); $sth->execute($userinput);
In the more general case, you can use sprintf to interpolate functions into strings:
my $sql = sprintf "select * from foo where bar = %s", $dbh->quote($use +rinput);

Comment on Answer: Calling a method within a double-quoted string?
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (19)
As of 2014-07-11 17:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (232 votes), past polls