On 4/4/07, Michael Gargiullo <[EMAIL PROTECTED]> wrote:
I have a log file I'm parsing that has special characters at the end of each row. In vi it appears to be ^@
You can use a hex-dump utility to see what characters are actually in the file. On unix, I often use od. But if I've got the data in a Perl string, I'll just use Perl: print "####", unpack("H*", $data), "\n"; # debug hex dump
I've already tried chomp and s/\^\@// Neither work.
You tried chomp? Did you also try sqrt? :-) Even though that character looks like ^@ in a program such as vi, that's not one of the ways Perl uses for writing special characters. I suspect that this one is the NUL character, and vi is calling it "control-@" (which makes some sense from the ASCII chart). If that's it, it's character zero, which can look as simple as "\0". s/\0+//g; # strip NUL characters Good luck with it! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/