perl - How can I conditionally insert lines when using Tie::File? -


How can I change this code to include missing lines without deleting the existing code?

  Tie my @ lines, 'tie :: file', $ fn or die "Could not tie the file: $!"; ($ My $ i = 0; $ i & lt; @lines; $ i ++) {If ($ ln_title == 0) {if ($ i  

Your requirements seem a bit unclear, so it's hard to tell What do you want.

If you want to insert a TITLE "" line after the line instead of the (overwritten) line instead of the TRACK line < Code> TRACK line, then you can use the following in place of $ rows [$ i + 1] = ... :

  Splice @ line, $ i + 1, 0, 'TITLE' '';  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -