Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by plaid (Chaplain)
on Jun 10, 2000 at 04:11 UTC ( #17473=categorized answer: print w/replies, xml ) Need Help??

Q&A > object-oriented programming > Calling a method within a double-quoted string? - Answer 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);

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
NodeReaper waits for the new pizza guy, again

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2017-02-21 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (313 votes). Check out past polls.