On Aug 22, 2005, at 13:26, Nath, Alok (STSD) wrote:
Hi Guys, I have this script which reads this text file and splits each line based on comma operator.The strange thing is it is removing the last character from the last word in the last line.So it is not displayed completely. Can anybody tell me why its so ?
My bet is that the last line has no newline character at the end. Replace the call to chop() which unconditionally removes the last character, with a call to chomp(), which removes the newline[*] if it finds it.
BTW, there is no need to escape the comma in the regexp. -- fxn [*] To be precise removes a trailing $/, which defaults to \n. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>