Re: [exim] Need a little perl advice

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Marc Perkel
Date:  
À: John Jetmore
CC: exim-users
Sujet: Re: [exim] Need a little perl advice


John Jetmore wrote:
> On Tue, 25 Jul 2006, Marc Perkel wrote:
>
>
>> print "insert ignore into karma (ip,expire,hostname) values
>> ('",$ip_address,"',",time()+200000,",'",$hostname,"');\n";
>>
>
> variables interpolate in "" quote strings in perl, so the only thing you
> have to exclude from the strings is the time()+200000 expression. Then
> you can join the pieces with the '.' operator, which is the string
> concatenate operator:
>
> mysql("insert ignore into karma (ip,expire,hostname) values " .
>       "('$ip_address'," . time()+200000 . ",'$hostname')");

>
> (if memory serves you don't need the semicolon to terminate the statement
> when using the perl modules w/ mysql, and you definitely don't need the
> newline).
>
> and then use $_[0] or shift it into another var to use.
>
> --John
>


> Thanks - let me give that a try.