Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Re: Redefining chomp()

by amw1 (Friar)
on Mar 24, 2004 at 15:18 UTC ( #339427=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Redefining chomp()
in thread Redefining chomp()

Wouldn't this be a good place to use local? Something like
{ local $/ = "\n\r"; chomp; }
protect the global state of $/ and let you deal with changing it's behavior right before the chomp. The scope could be increased until you've captured all of your chomp calls. Any new chomps you write, unless they're in the same scope as the local call would use the default value of $/
code is untested.

Replies are listed 'Best First'.
Re: Re: Re: Re: Redefining chomp()
by biosysadmin (Deacon) on Mar 24, 2004 at 17:49 UTC
    If he doesn't want to search the entire code to replace calls to chomp, it's likely that he wouldn't want to locally redefine $/ by putting blocks around each chomp statement.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2019-07-18 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?