in reply to chomp not working

If you are on a *nix-like environment you could look at the file using od to get an idea of what line terminator is actually being used. Failing that, write a quick script to read the first couple of hundred characters from your file into a buffer and then do something like

print qq{@{ [ ord $_ ] } => $_\n} for split m{}, $buffer;

This will give you the ordinal value for each character and the character itself, one per line. You should be able to spot the line terminator from that. Then you could set $/ (see perlvar) to what you have found so that chomp will work.

I hope this is useful.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^2: chomp not working
by Fletch (Bishop) on Dec 07, 2007 at 00:13 UTC

    . . . and if you're not on a *NIX-y environment you can always look for od from something like Cygwin, or use the Perl version from ppt.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      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.