dear monks, is there a way to parse perl variable defined in config file which in turn is the sql statement that is read in a file-handle and assigned to the variable which is further executed via a db-handle. To elaborate further.... 1) suppose here is the config file say test_query.sql test_query.sql contains below. The variable $schema & $name are further defined in the master config file that is read separately.

select * from $schema.app_table where col1 = $name
2) my main perl script will read this file into a filehandler and assign to a variable that will be further passed to db-handler
open SQLFILE, $sqlFile or die "Cannot open file $sqlFile : $!\n"; $sqlRef = <SQLFILE>; $sth =$dbh ->prepare($sqlRef); $sth -> execute();
3) The issue here is i see below error at the prepare call as the perl-variable is not evaluated
:: DBD::Oracle::db prepare failed: ORA-00911: invalid character (DBD E +RROR: error possibly near <*> indicator at char (<*>$schema.app_table +)
4) Kindly help me point to right direction on how to go about evaluating the variable from config file. Let me know if you need more information ? Thanks in advance!!


In reply to How to parse perl variable defined in config file by udvk009

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.