Re: Chomp method



AndrewMcHorney wrote:
Hello

Hello,

I am wondering how the chomp function works. I am looking to see how I
can truncate new line and/or carriage returns from a string. Will chomp
do nothing if there are no carriage return or line feed at the end. If
the end of the string has a space will it leave it alone?

If $/ contains a string then chomp() removes the contents of the $/ variable
from the end of the string and it returns a count of the number of $/ that
were removed. If $/ contains undef or a reference then chomp() does nothing.



John
--
use Perl;
program
fulfillment
.



Relevant Pages

  • Re: equivalent of chomp in perl
    ... on Perl, comparable to K&R). ... chomp VARIABLE ... string that doesn't end in a newline. ... char *s; ...
    (comp.lang.c)
  • Re: equivalent of chomp in perl
    ... chomp VARIABLE ... string that doesn't end in a newline. ... and not just any last character. ... char *s; ...
    (comp.lang.c)
  • Re: reading line by line from file
    ... reading a line gives you a string that includes the ... trailing newline character; the "chomp" function deletes it. ...
    (comp.lang.c)
  • Re: equivalent of chomp in perl
    ... on Perl, comparable to K&R). ... chomp VARIABLE ... string that doesn't end in a newline. ... and not just any last character. ...
    (comp.lang.c)
  • Re: reading line by line from file
    ... reading a line gives you a string that includes the ... trailing newline character; the "chomp" function deletes it. ...
    (comp.lang.c)