Re: [exim] Need a little perl advice

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Marc Perkel
Ημερομηνία:  
Προς: John Jetmore
Υ/ο: exim-users
Αντικείμενο: 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.