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

Re: [MacPerl] Problem with record separator?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 11:32 PM -0600 1/21/98, Wade Williams wrote:

} I'm having a strange problem reading in a file.

Where's the file coming from?  A netatalk'ed/CAP'ed Unix disk, perhaps?  Or
maybe it's a Unix text file sitting on a Mac disk?  If you have the editor
Alpha, simply open the file, and it will tell you what type of text it is.
(BBEdit does the same, I'm told.)

}
} I read in the file, and the whole thing gets stuffed into $_ as one line.
}
} Ok, no problem, says I.  The record separator is just wrong since I'm on a
} Mac.  I check the file out with a hex editor, and find 0x0A is what's
} separating the lines.
}
} So, before opening the file, I do:
}
} $/="0x0A";

Now you've changed the record seperator into the four byte string "0x0A".
You want simply $/ = "\n" or $/ = "\x0a" or $/ = "\015".  But it's
automatically \015 (^M, 0xa) on startup (what else would it be on a Mac?).
That's why I'm guessing you're reading a Unix text file, and MacPerl
doesn't find a single \015 in it before the end.

}
} And.....I get the whole file in one line again.
}
} Can anyone give me a clue as to why this might be happening?  The version
} of MacPerl is 5.1.4r4 (I'm upgrading to 5.1.9r4 as I type this).
}
} Wade
} ---------------------------------------------------------------------------
} Wade Williams                      "Put your message in a modem, and throw
} Systems Engineer, CCIE #3373        it in the cyber sea."
} Cisco Systems, Inc.                       - N. Peart
} Brentwood, TN
} 615-221-2918
} wwilliam@cisco.com
} ---------------------------------------------------------------------------

- -----
Paul J. Schinder
schinder@pobox.com


-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBNMdKxFZaVc52j0XhEQJl4QCfbcVvJbQdyrHkfi489W/gNFBWujYAoKfZ
KxtISbbo6EaBPxR59WSTeQGj
=u96J
-----END PGP SIGNATURE-----


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch