in reply to Strange character beginning text files
Well if chomp is not stripping it then its not a return character. You could try chop, if its always on the end of the line.
Alternatively you could convert it to bits like this: map { print unpack "B*", chr } qw\0001\ Or, to just characters like this: map {print chr }qw/0001/ ... and then check it out against an ASCII table on the net and see what it converts to.try here
Interestingly I ran this on the character and got a NULL string, that is, 00000000. Hence why chomp mightn't be picking it up. What you are seeing could be how your NULL appears in your flat file, which would also explain why its probably not showing in Notepad. Additionally when I attempt to convert it to a character using "chr" I get nothing appearing on my console, which also explains the possibility of NULL character as well.
Furthermore, strings in memory are terminated with a NULL character, which the computer uses to signify the end of the string. If your flat file is the result of something that was written to it from another program the character could very well be NULL's at the end of each string.
Again all this is hypothesis. How to remove them depends on where they are appearing in the flat file. If you are the creator of the flat file trying amended the program that writes it to chop the last character from each string/line before writing it to the flat file. Or convert the whole file to bits, delete all nulls, and then convert back to characters (probably not required unless you're really desperate).
As a side note, the 1 on the end of this 0001 suggests to me if could also be the 00000001 character which is the "Start of heading" character unless your question is simply relating to the box () which for me comes out as 00000000
Dean
The Funkster of Mirth
Programming these days takes more than a lone avenger with a compiler. - sam
RFC1149: A Standard for the Transmission of IP Datagrams on Avian Carriers
Alternatively you could convert it to bits like this: map { print unpack "B*", chr } qw\0001\ Or, to just characters like this: map {print chr }qw/0001/ ... and then check it out against an ASCII table on the net and see what it converts to.try here
Interestingly I ran this on the character and got a NULL string, that is, 00000000. Hence why chomp mightn't be picking it up. What you are seeing could be how your NULL appears in your flat file, which would also explain why its probably not showing in Notepad. Additionally when I attempt to convert it to a character using "chr" I get nothing appearing on my console, which also explains the possibility of NULL character as well.
Furthermore, strings in memory are terminated with a NULL character, which the computer uses to signify the end of the string. If your flat file is the result of something that was written to it from another program the character could very well be NULL's at the end of each string.
Again all this is hypothesis. How to remove them depends on where they are appearing in the flat file. If you are the creator of the flat file trying amended the program that writes it to chop the last character from each string/line before writing it to the flat file. Or convert the whole file to bits, delete all nulls, and then convert back to characters (probably not required unless you're really desperate).
As a side note, the 1 on the end of this 0001 suggests to me if could also be the 00000001 character which is the "Start of heading" character unless your question is simply relating to the box () which for me comes out as 00000000
Dean
The Funkster of Mirth
Programming these days takes more than a lone avenger with a compiler. - sam
RFC1149: A Standard for the Transmission of IP Datagrams on Avian Carriers
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Strange character beginning text files
by tachyon (Chancellor) on Jul 20, 2004 at 04:59 UTC | |
by graff (Chancellor) on Jul 20, 2004 at 05:12 UTC | |
by tachyon (Chancellor) on Jul 20, 2004 at 05:26 UTC | |
by wfsp (Abbot) on Jul 20, 2004 at 07:28 UTC | |
by tachyon (Chancellor) on Jul 20, 2004 at 05:17 UTC |
In Section
Seekers of Perl Wisdom