On Sat, Jul 13, 2002 at 06:14:34PM +0800, Connie Chan wrote: There seems to be something fishy with your system or the files you are using.
> May I ask what kind of system you are using ? I'm curious about your system too. > For me, Win32, I will use chop, like > chop($input); # Kill whatever the last char at a line On Win32, the line terminator is usually "\015\012", or CRLF. Of course, the file you are reading may not have the usual endings for the system it is on. Your use or otherwise of binmode() will also affect what is read into the string. chop() only removes the last character from the string, so you may be left with a CR at the end of the string if you are not careful. chomp() removes the value of $/ from the end of the string. This is generally seen as safer providing, of course, that the value of $/ matches what you are wanting to remove. By default that should be the case. > But if I go on with unix like system, I have to use chomp, like > chomp($input); # kill only CR at the end of line. On a Unix system, that would normally be LF. (On Macs it would be CR.) Since the line terminator here is normally a single character, chop() should work fine, although chomp() is better of course. > I don't know why, but chomp doesn't take effect on my system (Win32). It would be interesting to know why. Are the lines in your files not CRLF terminated? Have you used binmode at all? Are you using cygwin? Samba? > So you may try both to find the one fit you needs. For text files, that should really be chomp(). -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
