HI monks,

i have several lines of code as below

write_x("top.inst1.inst2.reg",32'h30,status,"string"); write_x("mod.ins5.ins7.val",{24'h0,4'h2,variable1,variable2},status,"s +tring");

i am trying to change the above 2 lines to the format

writing.reg("top.inst1.inst2.reg").write(status,32'h30); writing.reg("mod.ins5.ins7.val").write(status,{24'h0,4'h2,variable1,va +riable2});
i have written a script
open (input_file,"input.txt") || die"cannot open file"; open (output_file,"output.txt") || die"cannot open file"; $line = input_file; while ($line ne "") { @words = split(/[(,"]/,$line); if($word[0]=~/write_x/) { foreach(@word) { print $index; if( $_=~/write_x/) { print output_file_ex ("writing.reg(\"$word2\").write($word[5 +,]$word[4]);\n");} } else { print output_file_ex ($line); } $line = <input_file>; }
the problem is for the second line...{24'h0,4'h2,variable1,variable2} i need to find a way to say the split command to exclude , in this {} ..Thanks in advance

In reply to want to ignore pattern under{} in split command by jag194u

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.