>>Replace the unwanted newlines before giving the file to your script. > >That gets me wondering. What if he doesn't want to have to run two >scripts? What's the easiest way to perform > > cr_filter < infile | analysis_program > >under MacPerl? Winners, if any, by concensus... > I don't see how the pure MacPerl solutions submitted so far would simplify Noe's life. They would require extra code for his Macperl program if it must "know what is in the file". I really think two scripts would be best. A Hypertalk script is most likely what created Noe's text file in the first place. Nevertheless, here are a couple of unlikely possibilities... - A MacPerl program could read the original Hypercard stack (file) and if you knew or could determine its file structure you could weed out any Hypertalk stack code, background(s) code, card code, card and background field and button code and name, location, size, etc., etc., etc. so you could retrieve the data for each field for each record. - One could use Hypercard's "Save a Copy..." menu item and by selecting "Custom File Type" save the Hypertalk text as well as code. You have to deal with similar problems as mentioned in the first possibility. A pure MacPerl approach could be achieved but would require considerable more code than it would if a MacPerl script cooperated with a Hypertalk script. Maybe Hypercard's file formats are available publically. If anyone knows of such please email me of how I can obtain them and hopefully I'll find time to create a module to allow MacPerl easy access to Hypercard's treasures without getting Hypercard involved. My suggested two script (one Hypertalk, one MacPerl) solution... A Hypertalk program could selectively gather data from each of a Hypercard card's fields and write something unique like 'XZX' after writing the field's data and something like 'ZXZ' after writing all data for Hypercard card. open file FILENAME write bkgnd fld "whatever1" & "XZX" to file FILENAME write bkgnd fld "whatever2" & "XZX" to file FILENAME write "ZXZ" to file FILENAME close file FILENAME If the file is not too large your MacPerl program can read the resulting text file all at once and then split on 'ZXZ' to create an array of record and then split each record on 'XZX' to create an array with each Hypercard's field. open(FILEDATA, "$file_path") || die "No $file_path: $!"; $file_data_fork_size = -s $file_path; $buffer = read(FILEDATA, $read_results, $file_data_fork_size, 0); close(FILEDATA); @records = split("ZXZ", $read_results); for($i=0;$i<@file_lines;$i++){ @fields = split("XZX", $records[$i]); # DO SOMETHING } ----------------- Later, David Seay http://www.mastercall.com/g-s ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org