The Ghost am Dienstag, 10. Januar 2006 21.57:
> I want to pull some text from a database:
>
> RxNumber in (select RxNumber FROM restoreReports WHERE Status in
> $Status)
>
> then I want perl to use this string and interpolate the variables
> ($Status).
>
> so:
>
> my $Status= "('New','Old')";
> my $sql=get_SQL_String(); #will get 'RxNumber in (select RxNumber
> FROM restoreReports WHERE Status in $Status)'

$sql=~s/\$Status/$Status/;

(first time as literal string, second time as perl variable defined in the 
surrounding context)

see

perldoc perlre

> print $sql;
>
> # should print:
>
> RxNumber in (select RxNumber FROM restoreReports WHERE Status in
> ('New','Old'))
>
>
> What can I do?

hth,
joe

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to