Hi all, I have a file which looks like:
<QUERY name="Secondary">
<SQLStmt>select * from my_tb;
</SQLStmt>
<QUERY name="primary">
<SQLStmt>select * from my_tb;
</SQLStmt>
<QUERY name="last">
<SQLStmt>select * from my_tb;
</SQLStmt>
I need to substitute the SQLStmnts with some other SQLStmnts and Query name I received from commandline.
How can I use a condition to match and substitute?
$qury_nm=shift;
$sqlstmt=shift;
undef $/;
if(/<QUERY name="$qury_nm">(.*)<SQLStmt>(.*)<\SQLStmt>/)
{
#need help here!!
substitute the matched qury_nms SQLStmt wth the $sqlstmt and write it into the same file...
}