I know I could do that, but what if I don't know the variable names
in the string?
$sql=~s/\$Status/$Status/;
could I do:
$sql=~s/\$(\S+)/${$1}/;
On Jan 10, 2006, at 5:57 PM, John Doe wrote:
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>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>