[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Another elementary question



Still trying to get the hang of file I/O.  With the help the MacPerl list
I've gotten the following script working:

#!perl -w
$iput = "Address.txt"; # name the file, edits much easier. my copy of your
script
$oput = "Report";   # ditto
open (IN, "<$iput") or die ("Input File '$iput' open failed\n");
open (OUT,">$oput") or die ("Output File '$oput' open failed\n");
print ("starting loop\n"); # still to stdout
$x = 0;
while ($line = <IN>) {
			$x++;

				print OUT ("****** RECORD $x **********\n");
    @line = split (/\t/,$line);
      for ($i =0; $i <=$#line; $i++) {

						 print OUT ("Field $i:
$line[$i]\n"); 								#
this uses $_ the default loop variable
      }

   }
print  ("end of loop\n"); # still to stdout
print ("$x records read \n");
close (IN);
close (OUT);

****
When I run it I get the following output:

# Value of <HANDLE> construct can be "0"; test with defined().
File 'DorjeJigje:Programming:MacPerl Ä:Noe's Perl Stuff:addRpt3'; Line 8
starting loop
end of loop
1376 records read
******
The problem with this result is that there are only 989 records.  This is a
text file exported from a Hypercard stack and it seems that whenever there
is a <RET> in a large text field, MacPerl interprets that as a record
delimiter. Is there some reliable data massaging that can get the record
delimiter to be properly perceived by MacPerl?  I have WordPerfect and
Microsoft Word, as well SimpleText (although that can't handle such a large
file) but don't know if soft vs. hard returns is the relevant issue when
saving   as a text file.   I'm not aware of the internals of Hypercard
(which is beyond the scope of this mailing list) but figure there must be
some way to do this.  Any help and/or insights would be appreciated.




	Noe

	          \\\
	         (@v@)  W
	          (  O )  //
	            |  | //
	          /  ? |/
	         //     |
	         |||     \
	         M| /\ |
	            ||   ||
	            ||   ||
	            LL  LL
		



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org