Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Re: Entering external data

by ido50 (Scribe)
on Aug 10, 2003 at 13:19 UTC ( [id://282610]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Entering external data
in thread Entering external data

Well to be quite honest I got this sentence ("chomp erases the last...") from the Camel book. It's not a direct quote, that's just what I remembered. I would have looked it up again if I haven't returned the book to my university library last week.
And about the documentation link, I'll do that from now on.

-------------------------
Live fat, die young

Replies are listed 'Best First'.
Re: Re: Re: Re: Entering external data
by blue_cowdawg (Monsignor) on Aug 10, 2003 at 14:23 UTC

    Actually ido50 the description of chomp I get from perldoc -f chomp is as follows:

      chomp This safer version of "chop" removes any trailing string that corresponds to the current value of $/ (also known as $INPUT_RECORD_SEPARATOR in the "English" module). It returns the total number of characters removed from all its arguments. It’s often used to remove the newline from the end of an input record when you’re worried that the final record may be missin +g its newline. When in paragraph mode ("$/ = """), it removes all trailing newlines from the string. When in slurp mode ("$ +/ = undef") or fixed‐length record mode ($/ is a reference + to an integer or the like, see perlvar) chomp() won’t remove anythin +g thing. If VARIABLE is omitted, it chomps $_.

    Meaning that if you want to get rid of the newlines chomp is your better bet over chop.

    The command "perldoc" is your friend.


    Peter @ Berghold . Net

    Sieze the cow! Bite the day!

    Nobody expects the Perl inquisition!

    Test the code? We don't need to test no stinkin' code!
    All code posted here is as is where is unless otherwise stated.

    Brewer of Belgian style Ales

Re: Re: Re: Re: Entering external data
by CountZero (Bishop) on Aug 10, 2003 at 15:36 UTC

    Thus quoth the Camel-book on chomp:

    This function (normally) deletes a trailing newline from the end of a string contained in a variable. This is a slightly safer version of chop (described next) in that it has no effect upon a string that doesn't end in a newline. More specifically, it deletes the terminating string corresponding to the current value of $/, and not just any last character.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      "This function (normally) deletes a trailing newline from the end of a string contained in a variable. This is a slightly safer version of chop (described next) in that it has no effect upon a string that doesn't end in a newline."

      That's what I remembered.

      "More specifically, it deletes the terminating string corresponding to the current value of $/, and not just any last character."

      That's what I forgot (-: .

      -------------------------
      Live fat, die young

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://282610]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-19 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found