Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: chop and chomp

by manoj_speed (Parson)
on Mar 17, 2009 at 13:50 UTC ( #751195=note: print w/replies, xml ) Need Help??


in reply to chop and chomp

chop is used to remove the last character,chomp function removes only line endings.

chop removes the last character and returns the character chopped. Chomp removes any trailing string that corresponds to the current value of $/ and returns number of characters removed.

Replies are listed 'Best First'.
Re^2: chop and chomp
by ikegami (Pope) on Mar 17, 2009 at 14:04 UTC

    chomp function removes only line endings

    Only for a very specific definition of line endings. That's misleading. It won't even remove a Windows line ending (CRLF) on a Windows machine by default. Nor would you want it to do so.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://751195]
help
Chatterbox?
[karlgoethebier]: Cojones! We need cojones!
[karlgoethebier]: Ouch! Permissions! We need permissions!
[BarApp]: I can not use modules. I gain temporary access and still can not use modules.
[Cosmic37]: ta erix - this szabo geezer is pretty cool methinks and he writes about undef but I cannot see instructions for redefining the record separator after having undefined it
[Corion]: $/ = "wahtever";
[Corion]: (it's a magic variable)
[karlgoethebier]: BarApp: whoami
[Cosmic37]: ok fankyou - I was wondering about that but thought there might be a redefine command or something; peachy
[Lotus1]: Cosmic37 if you undef $/ in a local context to a block it won't affect the global version after the block finishes

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-06-29 16:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (672 votes). Check out past polls.