in reply to text parsing question

My feeling is that you don't need to worry about it. AFAICT, parsing should be as follows:

  1. Records are "paragraph" delimited; you can read records from the input stream by setting $/ = '';
  2. Fields within records are separated by literal space characters: my @fields = split / /;
Then some of the fields (the "String" ones) may have newlines in them; those should be easy to find and discard if you want.

A word spoken in Mind will reach its own level, in the objective world, by its own weight

Replies are listed 'Best First'.
Re^2: text parsing question
by perlAffen (Sexton) on Oct 01, 2007 at 15:25 UTC
    so once I place all the words of the paragraph in an array, how do I eval each one and rebuild the paragraph or string ? I think I know how to do this in bash....
    mynewline="" for i in ${fields[@]} ; do if ! echo $i |grep -q "newlinechar" ; then mynewline="$mynewline $i " fi done mynewline=`echo $mynewline | sed "s/^ //g"`

    How to do this in perl is beyond me at the moment.