Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi poj, thank you so much for your help, this is the first solution that does the job, but only, when the newlines were also re-inserted in the so called Header or tags, that are the strings starting with a square bracket. As you might have supposed, its a special text file with chess moves, but each of the square brackets has to be on its own line, otherwise a chess program can not interpret the file. As I'm new to perl, I have to work hard to understand your code, but I will try my best. The line: $line =~ s/ (\d+\. )/\n$1/g; does to my understanding the job of re-inserting the newlines but only with the numbered lines. I have added the line: $line =~ s/ (\[ )/\n$1/g; and I had hoped this will re-install the newlines for the tags, but for no good. If you can post a solution with newlines also for the tags, I would be very thankful to you.


In reply to Re^4: Substitution don't work with a special inputfile by OldChamp
in thread Substitution don't work with a special inputfile by OldChamp

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 21:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found