in reply to chomp not working

The chomp documentation specifies that the function "removes any trailing string that corresponds to the current value of $/ (also known as $INPUT_RECORD_SEPARATOR)", which defaults to the newline character, \n.

I'm not sure what those characters are, but when I am trying to identify unusual characters, I use the ord function:

#!/usr/bin/env perl use warnings; use strict; my $str = 'abcde'; for (split //, $str) { print "$_:", ord $_, ":\n"; }
Once you identify the characters, it will be easier to figure out a way of eliminating them.

Replies are listed 'Best First'.
Re^2: chomp not working
by djbryson (Beadle) on Dec 07, 2007 at 14:55 UTC
    Good idea. I shortened the file to 2 lines to shorten the output, here's the output:
    t:116 e:101 s:115 t:116 :13 :13 :10 t:116 e:101 s:115 t:116 :13 :13 :10
    So there's 3 chars at the end of each line? 13,13,10 if you're curious here's where i got the file: link It's xml. I use a "get" to throw the content into a var, then write the var to a text file.