Hello again mdavies23,

I recommend the closing of file handles because the output of you text might be still on the buffer. Read here why it is important to use close.

Maybe your code works straight out of the box with the close fh function I do not know yet. I will create an RTF document and I will start playing with it.

We are here to assist and guide. I hope you are not taking my suggestions in an insulting way. We all where beginners and we are still are in different areas. Just keep reading as much possible documentation provided here or on the network and you will learn really really fast.

Update: Sample of RTF file provided bellow. In case that someone wants to play with. The source of the code is The_RTF_Cookbook/SAMPLE COMPLETE RTF DOCUMENT.

{\rtf1\ansi\deff0 {\fonttbl {\f0 Times New Roman;} } \deflang1033\widowctrl {\header\pard\qr\plain\f0{\noproof\i La dame} p.\chpgn\par} \lang1036\fs36 {\pard\qc\f1\fs60\b\i La dame\par} {\pard\sb300\li900 Toc toc Il a ferm\'e9 la porte\line Les lys du jardin sont fl\'e9tris\line Quel est donc ce mort qu'on emporte \par} {\pard\sb300\li900 Tu viens de toquer \'e0 sa porte\line Et trotte trotte\line Trotte la petite souris \par} {\pard\sb900\li900\scaps\fs44 \endash Guillaume Apollinaire, {\i Alcools}\par} \page\lang1033\fs32 {\pard\b\ul\fs40 Vocabulary\par} {\pard\li300\fi-150{\noproof\b toc }{\i(n.m.)} \endash tap; knock\p +ar} {\pard\li300\fi-150{\noproof\b lys }{\i(n.m.)} \endash lily\par} {\pard\li300\fi-150{\noproof\b fl\'e9trir } {\i(v.itr.)} \endash to wilt; for a flower or beauty to fade; for a plant to wither\par} {\pard\li300\fi-150{\noproof\b mort } {\i(adj., here used as a masc. noun)} \endash dead\par} {\pard\li300\fi-150{\noproof\b emporter } {\i(v.tr.)} \endash to take a person or thing [somewhere]; to take\~[out/away/etc.] or carry\~[away] a thing\par} {\pard\li300\fi-150{\noproof\b toquer } {\i(v.itr.)} \endash to tap; to knock\par} {\pard\li300\fi-150{\noproof\b trotter } {\i(v.itr.)} \endash to trot; to scurry\par} {\pard\li300\fi-150{\noproof\b souris }{\i(n.f.)} \endash mouse\par +} {\pard\sb200\b\ul\fs40 Free Translation\par} {\pard Click click He closed the door / Garden lilies faded / Which body is + today // You just tapped on the door / And tip toe / Taps the little mous +e \line \_Translation Sean M. Burke, 2001 \par} }

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re^3: How to tokenize a RTF file and print it to another file by thanos1983
in thread How to tokenize a RTF file and print it to another file by mdavies23

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.